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 Feb 4, 2004, at 7:21 PM, Douglas Gregor wrote:

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.

Do you happen to know what systems it fails on, and what the use cases look like?

The reason I ask: seems to me that if you're on ELF or anything at all
like it (i.e. anything where SUPPORTS_ONE_ONLY is true), then weak
symbols should be merged across shared libraries and it'll just work as
expected.

Hm... Just occurred to me that maybe there is one obscure system where
SUPPORTS_ONE_ONLY is true but where symbols would only get
merged within a single shared library. I wouldn't be surprised if MS-
Windows met both of those criteria. Maybe this really is a case where the
compiler and the support library are being too ELF-centric.


--Matt


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