> It did mention -GR somewhere along the line. I thought that with MFC,
> RTTI was on by default - otherwise, how does
> CObject::IsKindOf(RUNTIME_CLASS(class name) ) work? I don't have to
> add any extra compiler options for that to work...
MFC was written prior to RTTI being available to C++. MFC's runtime type
identification is implemented by hand, and does not use C++ RTTI at all.
> Why? If dynamic_cast will return NULL for something which is NOT the
> right type, how can it be dangerous? Or is it dangerous because trying
> to cast anything other than a genuine pointer (to another pointer
> type) will cause problems? It's a bit of a lousy feature if it won't
> at least safely attempt to cast ANY type to another before it starts
> checking. I realise the value I get could be completely of
> the wrong type, but isn't that the whole point of using this
> feature, to CHECK if it's the right type?
The reason it's dangerous is because of adding an entry to the object's
v-table, like I have pointed out in my other email.
dynamic_cast is pretty safe and handy for those places where COM is not
involved.
-------------
Ehsan Akhgari
List Owner: [EMAIL PROTECTED]
[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]
It is dreadful to die of thirst in the sea. Do you have to salt your truth
so much that it can no longer even - quench thirst? -Beyond Good And Evil,
F. W. Nietzsche
