Using gcc version 3.2 ...
The compiler likes to optimize away calls to dynamic_cast - so, for
instance, if I do this :
class Base { ... }
class Derived : public Base { ... }
Base b;
Derived *d = dynamic_cast<Derived*>((Derived*)&b);
(yes, that's a stupid thing to do, it's just that to explain the real issue
would take more pages than you want to read)
That code happily sets d to &b because the compiler says "Hum, I've been
given a Derived*, obviously that's the same as a Derived*, so I can just
turn the dynamic_cast into a static_cast."
Is there a way to disable this particular optimization?
Thanks!
Chris