From 454651875554998662
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,5cc0e5689db82f7b
X-Google-Attributes: gidf78e5,public
X-Google-Thread: f635e,e7776fa3664990ff
X-Google-Attributes: gidf635e,public
From: "Paul D. DeRocco" <pderocco@ix.netcom.com>
Subject: Re: Is type_info object static or temporary?
Date: 1998/06/06
Message-ID: <3578C2EA.18AA8308@ix.netcom.com>#1/1
X-Deja-AN: 360243140
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <356D82DA.36025D97@matfys.lth.se> <6kl3ar$npi$1@shell7.ba.best.com> <35727d32.0@210.134.196.10> <oryavgswwj.fsf@zecarneiro.lsd.dcc.unicamp.br>
Mime-Version: 1.0
Originator: clamage@taumet
X-NNTP-Posting-Host: bst-ma5-02.ix.netcom.com
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
Organization: Vast Right-Wing Conspiracy
X-NETCOM-Date: Fri Jun 05 10:18:06 PM CDT 1998
Newsgroups: comp.std.c++,comp.sys.mac.programmer.codewarrior


Alexandre Oliva wrote:
> 
> type_infos, OTOH, have a direct correspondence with
> actual types

Is that entirely true? Obviously, two different types will never return
the same type_info, but isn't it expressly legal for the same type to
return different typeinfo objects at different times, as long as they
compare equal with operator==?

If so, I think this is in order to accommodate dumb linkers that have no
mechanism for ensuring that only a single copy of a type_info will be
kept when multiple modules introduce it. It's too bad, because if the
linker could be counted on to be this smart, then type_infos would
become atoms, and operator== could be implemented as a simple address
comparison (as could operator<). This would vastly speed up programs
that use type_infos as map keys, for instance--especially if the
alternative is to do a strcmp on the name strings, which is what Borland
does. Incidentally, I don't really understand why Borland does that,
since its linker is smart enough to ensure the uniqueness of type_info
objects.

-- 

Ciao,
Paul


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




