From 1455504869202280588
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fbd36da46c3cc7a0
X-Google-Attributes: gidf78e5,public
From: sirwillard@my-deja.com
Subject: Re: Discussion: type_info
Date: 1999/12/21
Message-ID: <83o4gf$quk$1@nnrp1.deja.com>#1/1
X-Deja-AN: 563473393
X-NNTP-Posting-Host: 167.16.119.20
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <82gmer$gqm$1@nnrp1.deja.com> <memo.19991206234642.50639A@btinternet.com> <384c8866.77375470@news.internetconnect.net> <82lv69$atk$1@nnrp1.deja.com> <3855bd24.78125498@news.internetconnect.net> <m3bt7qf9fs.fsf@grady.MtDiablo.com> <83kjmg$cru$1@nnrp1.deja.com>
X-UID: 0000000001
X-Status: $$$T
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)
X-Http-Proxy: 1.1 x32.deja.com:80 (Squid/1.1.22) for client 167.16.119.20
Organization: Deja.com - Before you buy.
X-Article-Creation-Date: Tue Dec 21 14:57:22 1999 GMT
X-MyDeja-Info: XMYDJUIDsirwillard
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <83kjmg$cru$1@nnrp1.deja.com>,
  Gene Bushuyev <gbush@my-deja.com> wrote:
>
> In article <m3bt7qf9fs.fsf@grady.MtDiablo.com>,
>   Alan Hadsell <ahadsell@MtDiablo.com> wrote:
> [snip]
> >
> > The compiler can't tell when it's compiling a class whether it needs
> > to generate its type_info, because it doesn't necessarily know whether
> > anyone will use typeid() on it.
>
> It doesn't need to generate the type_info per se. It can generate a
> code to produce type_info on demand.

OK, give us some code that will do this.  Remember that it must meet
the following requirements:

1.  It must generate unique strings for every type.
2.  It must insure the generated strings are the same for the types on
every run and across platforms and across library boundaries in the
case of dynamic libraries.
3.  It must retain a small fool print on the overall code.

I've been generous here and left out the requirement that the generated
string be human readable and meaningful to the type, which is the
implied (but not enforced) semantic of type_info::name.  These are the
characteristics everyone in this thread seems to want.  I think it's an
unreasonable desire and return back to my original proposal to just
generate a unique integral value per type with no gaurantees about
generating the same value except during a single run.

> [snip]
> > So only the linker has enough information to decide whether to include
> > a particular type_info object, and it can only do so if it can
> > determine the set of all types that might be returned from all
> > typeid() calls in the program.
>
> Does the standard say anything about the existance of a linker? This
> division is the heritage of the past I hope we are seeing the end of it.

The end of it how?  A linker must exist (even if you simply move it
inside the compiler, there's still a linkage phase) and the OPs point
remains.  Only the linking phase will allow for this optimization.
Unfortunately, with dynamic link libraries things get ugly indeed and
the optimization becomes impossible.  So we're left with your
proposal... only we need proof that such code can be generated.


Sent via Deja.com http://www.deja.com/
Before you buy.


[ 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              ]




