C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Common ABI specification

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Fri, 27 Jan 2023 21:55:28 +0000
On Fri, 27 Jan 2023 at 21:11, samuel ammonius wrote:

>
> GCC and IBM's C++ compilers use the same system for name
> mangling, which uses valid identifiers.
>

No it doesn't. A mangled name begins with a "_Z" prefix, which is not
allowed as an identifier, because it's a reserved name. So no program can
ever have "_Z1fv" as an identifier, which means it can be used as a mangled
name and won't clash with unmangled names like "f".

The problem with your proposed scheme is that mangling foo::bar as foo_bar
clashes with an identifier foo_bar. Don't try to make up your own mangling
scheme when we already have ones that work.

Received on 2023-01-27 21:55:43