[Insight-users] itk::LightObject::PrintSelf and name demangling with gcc

Brad King brad.king at kitware.com
Wed Dec 22 08:44:19 EST 2004


Julien Lamy wrote:
> Hello list,
> When using type_info::name and g++, the names of the objects are not
> correctly demangled (see [1] for examples). In version 3.1 of gcc, a new
> ABI function was exposed, which allows to demangle the names. 
> I think it would be nice to use this kind of demangling in
> itk::LightObject::PrintSelf, so that the RTTI information is human
> readable. 
> In [2], you'll find a small function that returns the demangled name if
> (1) we're using gcc > 3.1 and (2) the demangling succeeds. Otherwise,
> the raw result of std::type_info::name is used. This function can easily
> be put inside itk::LightObject::PrintSelf (actually, I've done it on my
> version) and does not seem to have any drawback. Should it be submitted
> on ITK's CVS, and if so, how can I do it ?
> 
> It has been tested with gcc versions 2.95.4, 3.3.4 and 3.4.2 on a
> Linux/i386.
> 
> [1] http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#5
> [2] https://dpt-info.u-strasbg.fr/~lamy/demangle.html

That looks pretty useful.  Please submit this as a feature request to 
the bug tracker here:

http://www.itk.org/Bug

and include the patch.

Thanks,
-Brad


More information about the Insight-users mailing list