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

Julien Lamy julien.lamy at ircad.u-strasbg.fr
Wed Dec 22 08:39:30 EST 2004


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
-- 
Julien Lamy <julien.lamy at ircad.u-strasbg.fr>



More information about the Insight-users mailing list