[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Obtaining the name of the C++ class from the pointer
From: |
Andreas Schallenberg |
Subject: |
Re: Obtaining the name of the C++ class from the pointer |
Date: |
Tue, 02 May 2006 10:18:11 +0200 |
User-agent: |
KNode/0.10.2 |
Thomas Maeder wrote:
> sheikashrub@gmail.com writes:
>
>> Thanks. I tried this and I seem to get a number infront of the
>> class name that is printed. Is this expected?
>
> The result of typeid(*ptr).name() is implementation defined. The only
> thing you can rely on is that it's a null-terminated string.
At least recent g++ support automatic demangling of these
strings into human-readable format.
For details, see thread "Re: RTTI and typeid().name()"
posted in in gnu.gcc.help on 12 Jan. 2005 by Guy Harrison.
Eventually the same code works on Intels compilers, too.
(To be checked...)
RU,
Andreas