This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: demengler in libstdc++ is changed
Matt Austern <austern@apple.com> writes:
> On Nov 14, 2003, at 4:01 PM, Phil Edwards wrote:
>
> > On Sat, Nov 15, 2003 at 12:50:28AM +0100, Gabriel Dos Reis wrote:
> >> |
> >> | FYI, GNU linker uses demangler in symbol version script for human
> >> | readable names.
> >>
> >> I think there should be a tool on top of the demangler in order to
> >> cope with semantic isomorphism like "const int" == "int const".
> >
> > At some point, we just have to rely on the user knowing the language.
> >
> >
> >> I'm not convinced the output of the demangler should be defined at
> >> character-precision level.
> >
> > I totally agree.
>
> I do too, mostly because I think we have no choice. Specifying a
> canonical form for C++ type declarations would be hard. (It can
> get a whole lot wilder than "const int" versus "int const *"!)
> I'm not saying it's provably impossible that anyone could ever
> write such a document, but I'm pretty sure nobody has ever done it.
We don't want or need to specify a canonical form for any C++
declaration (I'm not clear that this is even possible). Instead, we
just want to specify what the demangler will produce as output for
each of its inputs. Clearly this must be possible, because the source
code for the demangler does it, it's just a bit inconvenient to read.
For those cases where two declarations may be spelt differently in a
well-formed program and yet are equivalent, the mangled strings have
to be the same. So to do what Phil wants, you just have to mangle the
declaration again (I suggest doing this the easy way, which is to not
demangle in the first place).
--
- Geoffrey Keating <geoffk@geoffk.org>