RFC: change in std::type_info's equality operator
Douglas Gregor
gregod@cs.rpi.edu
Thu Feb 5 03:19:00 GMT 2004
On Wednesday 04 February 2004 12:58 pm, Matt Austern wrote:
> Right now, depending on whether or not a certain macro is set when
> libstdc++ is built, t1==t2 is equivalent to one of these two
> expressions:
> (1) t1.__name == t2.__name, where __name is the address of the string
> representing the type's name.
> (2) t1.__name == t2.__name || strcmp(t1.__name, t2.__name) == 0.
>
> The library uses version (1) iff the compiler defines __GXX_WEAK__ to
> be true.
>
> My proposal: change the library so it unconditionally uses version 2.
> That is, always fall back to string comparison if the address
> comparison
Please do! I've heard many complaints about type_info::operator== not working
across shared libraries, and we have (or need) workarounds in Boost in
several different places to deal with this.
This particular quirk always surprised me, because it's one of the few things
that just doesn't work across shared libraries.
Doug
More information about the Gcc
mailing list