This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: change in std::type_info's equality operator


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]