Re: dynamic_cast failing weirdly
Re: dynamic_cast failing weirdly
- Subject: Re: dynamic_cast failing weirdly
- From: Marshall Clow <email@hidden>
- Date: Tue, 24 Jul 2007 19:10:02 -0700
I have a bizarre situation in a project that I'm porting from
Windows (I just finally got everything to compile and link, so I'm
really just starting to play with the project, and with Xcode). I
have RTTI enabled for the project (and each of the several libraries
that it links against) via the "Enable C++ Runtime Types" build
setting, and dynamic_casts are resolving to NULL when they really
shouldn't be. The situation looks roughly like this:
In MyLib:
class A { //... };
(a function):
static A* GetA() { // return some A* }
In MyApp:
class B : public A { //... };
(some code):
A* a = GetA();
B* b = dynamic_cast<B*>(a);
ASSERT(NULL != b);
// do something with b
New angle, old bug.
See threads in the archives titled "Can't catch exception", and so on.
start here, say
<http://lists.apple.com/archives/xcode-users/2006/May/msg00743.html>.
or here <http://lists.apple.com/archives/xcode-users/2006/Jul/msg00279.html>
Also read tech note TN2185 'C++ tips and tricks for Mac OS X"
<http://developer.apple.com/technotes/tn2007/tn2185.html>
--
-- Marshall
Marshall Clow Idio Software <mailto:email@hidden>
It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden