This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: type_info::name
- To: rumcajs at gmx dot net
- Subject: Re: type_info::name
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 3 Mar 2000 19:03:50 +0100
- CC: egcs at egcs dot cygnus dot com
- References: <30474.952091574@www16.gmx.net>
> Is there a possibility to get a readable class name from type_info::name?
> With g++ I
> get
> t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0.
Not really. If you slightly tweak this string, you can pass it too
c++filt:
mira% c++filt foo__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0
basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::foo(void)
If you then strip the '::foo(void)' part, you get the type
name. Instead of c++filt, you can also use cplus_demangle, which is a
function from -liberty.
Regards,
Martin
P.S. I'd question whether the second form is more readable than the
first one, though.