Submission Date: 10 Dec 92
Submittor: WG14
Source: X3J11/91-008 (Randall Meyers)
Question 1
May a standard conforming implementation make characters in its character
set that are not in the required source character set identifier characters?
Can these additional identifier characters be used in preprocessor identifier
tokens as well as post-processor identifier tokens?
Subclause G.5.2 states:
Characters other than the underscore _, letters, and digits, that are not defined in the required source character set (such as the dollar sign $, or characters in national character sets) may appear in an identifier (subclause 6.1.2).
Response
May a standard conforming implementation make characters in its character
set that are not in the required source character set identifier characters?
Answer: Yes.
Can these additional identifier characters be used in preprocessor identifier
tokens as well as post-processor identifier tokens?
Answer: Yes, but the C Standard is currently ambiguous about the parsing
of a definition such as:
#define abc$ x
This could either define abc$ as x or abc
as $x. The Correction that follows resolves the ambiguity.
Correction
Add to subclause 6.8, page 86 (Constraints):
In the definition of an object-like macro, if the first character of a
replacement list is not a character required by subclause 5.2.1, then there
shall be white-space separation between the identifier and the replacement
list.*
[Footnote *: This allows an implementation to choose to interpret the directive:
#define THIS$AND$THAT(a, b) ((a) + (b))
as defining a function-like macro THIS$AND$THAT, rather
than an object-like macro THIS. Whichever choice it makes,
it must also issue a diagnostic.]