KDE/kdevplatform/language/duchain

David Nolden zwabel at googlemail.com
Wed Oct 8 20:17:57 UTC 2008


Am Mittwoch, 8. Oktober 2008 18:52:05 schrieb Andreas Pakulat:
> On 08.10.08 15:34:08, David Nolden wrote:
> > SVN commit 869243 by zwabel:
> >
> > Use static_cast instead of an unsafe reinterpret_cast.
> > This makes the c++ duchaintest succeed after manuel added his tests, and
> > might as well fix several other inconsistency problems.
>
> Now this won't compile anymore on MSVC. It would help if you'd checked who
> changed the code from static_cast to reinterpret_cast. As soon as I get
> around to it, I'll rebuild and post the exact error message, but it boils
> down to msvc not being able to cast the return of Base::d_func() to that
> Data class, because they're not related.
>
> Andreas

Ah I see it was you. I was wondering when I saw it why I used it, because it's 
not safe. Well, as you see gcc is clever enough to do the static_cast here, 
and I don't see why a compiler should not know how to do that. Of course the 
classes are related, one is derived from the other. It's just casting "down" 
the inheritance order instead of "up", it needs some offsets applied that 
reinterpret_cast does not do. But for windows you can try using a standard 
c-cast, like "return (Data*)d_func()", I think that also applies the offsets. 
If that works, we can just use that.

Greetings, David




More information about the KDevelop-devel mailing list