help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic_cast from base to another parent of derived class


From: Boris
Subject: Re: dynamic_cast from base to another parent of derived class
Date: Wed, 11 Oct 2006 03:37:46 +0300

F.J.K. wrote:
> Boris wrote:
>> I had created a small test case but unfortunately it worked. The
>> project I port is too large - it would take some time to track this
>> down which I don't have currently.
>
> Is the bug present in GCC 4.x?
> in mainline?

I don't know, I didn't try yet. For now I'm happy if I can work around the 
bug and finally release the software on Linux.

> Is there any reason you can't just do? (Real question, not just
> rhetorical :-)
>
> #ifdef __GNUC__ && __GNU__<4
> #define dynamic_cast static_cast
> #endif

Yes, I use something like this now:

#if defined(__GNUC__)
  const level1 &l1 = *static_range<const level1*>(&base);
#else
  const level1 &l1 = dynamic_cast<const level1&>(base);
#endif

>> From what I take from the discussion so far, you have assured your
>> code
> is semantically correct (See Pete Beckers guru-posting). At this

I'm as much sure as you can be with C++ code. ;-) What's 100% for sure 
though is that everything works when linked statically.

Boris 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]