public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* type_info::name question
@ 1998-09-14  2:45 Ryszard Kabatek
  1998-09-14  5:49 ` Alexandre Oliva
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Ryszard Kabatek @ 1998-09-14  2:45 UTC (permalink / raw)
  To: egcs

Is there any possibility to get the class name from type_info::name?

For typeid(string).name() I get:
't12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0'.


Ryszard Kabatek

Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
e-mail: kabatek@chemie.uni-halle.de


^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: type_info::name question
@ 1998-09-22  5:33 Ryszard Kabatek
  0 siblings, 0 replies; 23+ messages in thread
From: Ryszard Kabatek @ 1998-09-22  5:33 UTC (permalink / raw)
  To: egcs

Jason Merrill wrote:

> >>>>> Thomas Kunert  writes:
>
>  > Alexandre Oliva wrote:
>  >>
>  >> Ryszard Kabatek  writes:
>  >>
>  >> > Is there any possibility to get the class name from
>  >> > type_info::name?
>  >>
>  >> You might run `c++filt' and feed it the result of type_info::name(),
>  >> but you may prefer to create a library containing the unmangler
>  >> functions from c++filt and link your program with it.
>
>  > IMHO, type_info::name isn't useful at all if it returns some cryptic
>  > string. Is there some intention behind that behavior or is it just
>  > the shortest way towards conformance?
>
> Two reasons:
>
>  1) The mangled name is shorter, so the RTTI overhead is lower.
>  2) The mangled name is unique.
>
> Jason

Yes, the mangled name is `very' unique. 
It may change in the next egcs version.

What value do return other comilers for type_info::name?


Ryszard Kabatek
---
Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129


^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: type_info::name question
@ 1998-10-09  3:40 kunert
  0 siblings, 0 replies; 23+ messages in thread
From: kunert @ 1998-10-09  3:40 UTC (permalink / raw)
  To: oliva; +Cc: egcs

Alexandre Oliva wrote:
> 
> Thomas Kunert <kunert@physik.tu-dresden.de> writes:
> 
> > IMHO, type_info::name isn't useful at all if it returns some cryptic
> > string.
> 
> type_info::name *isn't* useful at all, as defined in the standard.  

Only if one clings to the paper as you do. 
The function is called `name', not `some_arbitrary_string'. IMO, that is
description enough. 

``Implementation defined'' doesn't mean ``as unuseful as possible to
prevent portability problems'' but ``make the best of it, everybody
should know about portability''. And if the function does what it's name
suggests -- giving the name of the type in some readable language -- it
*is* useful.

> If you really want a readable representation,
> I've already explained that it's just a matter of running c++filt or
> embedding it into your application.

Of course I can do that, in fact I have done this a long time ago, to
port some perfectly working code to egcs, but I hate rewriting functions
from the standard library only because of some weird chosen
implementation defined values.

Regards, 
Thomas


^ permalink raw reply	[flat|nested] 23+ messages in thread
[parent not found: <9810039073.AA907398810.cygnus.egcs@mrbusy.demon.co.uk>]
* Re: type_info::name question
@ 1998-10-12 20:53 Mike Stump
  1998-10-13 19:22 ` Mark Mitchell
  0 siblings, 1 reply; 23+ messages in thread
From: Mike Stump @ 1998-10-12 20:53 UTC (permalink / raw)
  To: egcs, jason, kunert

> To: kunert@physik.tu-dresden.de, egcs@cygnus.com
> From: Jason Merrill <jason@cygnus.com>
> Date: 11 Oct 1998 13:12:38 -0700

> How would people feel about including the demangler in libgcc, and
> calling from type_info::name?

The only concerns I guess I have are:

kankakee bash[42] size cxxmain.o 
   text    data     bss     dec     hex filename
  24349     120       4   24473    5f99 cxxmain.o

and the fact it calls malloc.  If it is only ever linked in when name
is called, it might not be too big.  Having it throw bad_alloc seems
better than xmalloc stuff, that's easy to fix.  Having sometimes throw
bad_alloc seems bad.  Also, if it allocates stuff, who deallocs?  The
Standard dones't have that interface.  Also, if it is a static buffer,
there is nothing in the standard that says the lifetime expires that
quickly.  So, I thinking the only solution would be to just put the
non demangled version in the .o file to begin with.  And if we do
that, then I worry about the total size of the .o files growing yet
some more.  Every 5% we add, is another 5% we don't get back.  :-(

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~1998-10-13 19:22 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-14  2:45 type_info::name question Ryszard Kabatek
1998-09-14  5:49 ` Alexandre Oliva
1998-09-16  1:48   ` Thomas Kunert
1998-09-16 21:52     ` Alexandre Oliva
1998-09-21  3:54       ` Thomas Kunert
1998-09-21  7:32         ` Alexandre Oliva
1998-09-21  9:44           ` Thomas Kunert
1998-09-22  6:35             ` Martin von Loewis
1998-09-17  9:59     ` Martin von Loewis
1998-09-14 11:02 ` Todd Vierling
     [not found] ` <35FF61BF.301D5EC7.cygnus.egcs@physik.tu-dresden.de>
1998-09-16 21:52   ` Nathan Myers
1998-09-17 18:37     ` Martin von Loewis
     [not found]     ` <199809172030.WAA01914.cygnus.egcs@mira.isdn.cs.tu-berlin.de>
1998-09-18 22:10       ` Nathan Myers
1998-09-19 12:03         ` Martin von Loewis
     [not found]         ` <199809191751.TAA00242.cygnus.egcs@mira.isdn.cs.tu-berlin.de>
1998-09-19 19:00           ` Nathan Myers
1998-09-21 14:55   ` Jason Merrill
1998-09-22  5:33 Ryszard Kabatek
1998-10-09  3:40 kunert
     [not found] <9810039073.AA907398810.cygnus.egcs@mrbusy.demon.co.uk>
1998-10-11 13:16 ` Jason Merrill
1998-10-11 19:05   ` H.J. Lu
     [not found] ` <u9ogrij1s9.fsf.cygnus.egcs@yorick.cygnus.com>
1998-10-12 22:24   ` Nathan Myers
1998-10-12 20:53 Mike Stump
1998-10-13 19:22 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).