This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: RFC: change in std::type_info's equality operator
- From: Douglas Gregor <gregod at cs dot rpi dot edu>
- To: Matt Austern <austern at apple dot com>, libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Wed, 4 Feb 2004 22:21:43 -0500
- Subject: Re: RFC: change in std::type_info's equality operator
- Organization: Rensselaer Polytechnic Institute
- References: <B31A11EE-573B-11D8-99B0-000A95AA5E5E@apple.com>
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