tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Incorrect demangling

On Tue, 24 Apr 2012, Rich Neswold wrote:
My "C++ Programming Reference, 2nd edition" (1994), section r.2.4 says:

"In addition, identifiers containing a double underscore (__) are reserved for use by C++ implementations and standard libraries and should be avoided by users."

That's in the C++ reference manual, so "users" should be understood to mean "users of the C++ language". The C++ reference manual should have no jurisdiction over users of languages other than C++.

Users of the C language should be able to find everything they need in the C reference manual and associated library reference manuals, plus the implementation-specific documentation (e.g. the compiler manual) if they rely on implementation-specific features of the language. Section 7.1.3 of the N1256 draft of the C2010 standard provides a list of rules for determining whether an identifier is reserved, and double underscore is featured only when it appears at the beginning of an identifier. The same clause also says "No other identifiers are reserved", so it seems pretty clear to me that identifiers that contain double underscore are not reserved in the C language (unless they also hit one of the other restrictions).

So it looks like you won't convince the GCC maintainers in changing the compiler. Plus, PCC and CLANG will probably give you similar problems.

It looks as though anything that performs demangling should have some way other than the symbol name of figuring out whether the symbol came from C++, so that it is not tripped up by valid C symbols that happen to mean something special when viewed as C++

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index