[PATCH] dynamic_cast and gcc3

Luis Pedro Coelho luis_pedro at netcabo.pt
Wed Nov 20 20:10:08 GMT 2002


Em Terça, 19 de Novembro de 2002 23:27, Malte Starostik escreveu:
> Nope. The type info is available as soon as any virtual is implemented
> (which is done by providing a virtual dtor). The problem is that as opposed
> to older gcc versions, 3.x uses the type info's address and not its name()
> for the equality operator which is used by dynamic_cast.
> But since both the main program and the plugin library provide the type
> info, the addresses won't compare equal.
> The dynamic_cast should work fine if kview (not the plugins) is compiled
> with -Wl,-E on gcc 3.x setups.
> -Malte

Hi,

The relevant documentation is at:

http://gcc.gnu.org/faq.html#dso

Also, check

info:/ld/Options on konqueror 
(I love this feature, used to hate info docs before, thanks to whoever worked 
on this)


Is there a reason why programms are not being compiled with this flag by 
default on the affected versions or was it just inertia? From the docs I see 
no reason why they shouldn't. There is a small performance hit on linking, 
but you get it back whenever you use address comparisons instead of 
strcmp()s. 

I don't know enough from the build enviroment to propose a patch, but someone 
more into it might take it up.

Regards,
-- 
Luis Pedro Coelho

check out my game of hearts for the KDE at

http://hearts.sf.net




More information about the kde-core-devel mailing list