This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: typeinfo *^%*&^%*&%
- To: David Chamont <chamont at polhp3 dot in2p3 dot fr>
- Subject: Re: typeinfo *^%*&^%*&%
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 11 Jun 1998 21:28:51 -0300
- Cc: egcs-bugs at cygnus dot com
- References: <357FD483.66F462D@polhp3.in2p3.fr>
David Chamont <chamont@polhp3.in2p3.fr> writes:
> The following program is surprisingly displaying "i" and "1A" :
What is surprising about it?
> cout<<typeid(int).name()<<endl ;
> cout<<typeid(A).name()<<endl ;
The result of typeinfo::name() is implementation-defined, don't expect
to get the same result when you use different compilers, or different
versions of the same compiler. G++ and egcs have chosen to return the
string produced by its own symbol name mangling mechanism. `i' refers
to the integer type, and `1A' refer to a class name of length `1',
namely, `A'.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil