local names
Alex Samuel
samuel at codesourcery.com
Fri Sep 1 05:24:39 UTC 2000
Jason Merrill <jason at redhat.com> writes:
Jason> Why not just put the foo inside the nested-name, rather than
Jason> using the local-name production for local types?
I thought of that, but that leads to some funny-looking results.
Suppose you have
class C {
void foo (int) {
class D {};
}
};
The mangling for C::foo() is `_ZN1C3fooEi'. Notice that the the
parameter type (`i') is outside the `N...E'. However, if you mangle
the local type D, you would get something like `N1CZ3fooiE1DE'. Now
the parameter type has to go inside the `Z...E' since otherwise you
can't tell where the function's signature ends.
If the usual mangling for functions were delimited by `Z...E' instead
of starting with `Z' but ending at the end-of-string, I'd definitely
advocate encoding a function scope similarly to a class or namespace
scope, in a <nested-name>. But given the above issue (and the fact
that we have currently two working mangling implementations and a
working demangler), I'd strongly recommend leaving it as it is, which
is correct and just as efficient.
Regards
Alex
More information about the cxx-abi-dev
mailing list