[C++-sig] Re: todo.txt "Implement type_info streaming for GCC"
Raoul Gough
RaoulGough at yahoo.co.uk
Thu Jul 10 19:42:45 CEST 2003
A while ago, David Abrahams wrote:
>There are a few places where error reporting in Boost.Python depends
>on being able to show users a reasonable representation of a C++ type
>name. Currently, we use typeid(x).name() to get the name. Most
>compilers produce a good result, however g++ does not. I just ran a
>small experiment to see if the type encoding scheme used by G++ could
>easily be deciphered, and it appears that it can. If we want to
>improve error reporting with G++, it should be relatively easy.
I seem to recall that the g++ typeid().name() gives you the type's
mangled name, in which case the supplied c++filt will decode it for
you (maybe modulo one leading underscore?). If so, I think a simple
system() call would probably suffice for what David is describing. Or
am I missing some more info on the difficulties involved?
The source to the demangler is GPL'd, of course (in
gcc/libiberty/cp-demangle.c) and is also including in gdb, AFAIK. It's
currently >3000 lines of code, so I wouldn't recommend trying to
reimplement it for Boost.Python!
--
Raoul Gough
"Let there be one measure for wine throughout our kingdom, and one
measure for ale, and one measure for corn" - Magna Carta
More information about the Cplusplus-sig
mailing list