This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: typeinfo *^%*&^%*&%


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



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