On Thursday 30 October 2014 12:52:10 Myriachan wrote:
> extern "C" int __identifier(class);
>
> __identifier also may take a literal string as a parameter, allowing weird
> characters in identifiers. I would say that the effect of using a literal
> string that is neither a legal C++ identifier nor a C++ keyword (i.e.
> something that'd work without being a string) has unspecified behavior,
> leaving it to the implementation to decide whether such a thing is
> meaningful or an error. This literal string feature can be used to access
> mangled symbol names if used in conjunction with extern "C", or could be
> used to put dollar signs in identifiers. And yes,
> __identifier(__identifier) is legal.
How about an identifier containing the closing parenthesis? You probably want
to have this as a string literal.
With GCC:
extern "C" int class_() asm("class");
extern "C" int closingparen() asm("(");
Or, maybe just use the backtick like SQL does:
SELECT `SELECT` FROM `FROM`;
But aside from external names, what use would this have? I'm not sure I
understood your example for wchar_t/char16_t and, to be honest, it's not
relevant because the standard can assume that the implementation fully
implements the standard.
--
Thiago Macieira - thiago (AT)
macieira.info - thiago (AT)
kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358