DR 4## Prev <— Open —> Next DR 4##, or summary at top
Submitter: Douglas Walls
Submission Date: 2016-02-23
Source:WG14
Reference Document: N/A
Subject: Concern with keywords that match reserved
identifiers
Summary
Should a conforming program be allowed to use identifiers spelled with a leading underscore followed by an uppercase letter that match the spelling of a keyword?inline
as a macro name, but a conforming program
cannot use _Noreturn
as a macro name.Noreturn
as a macro because they knew it is an
identifier reserved to the implementation. I was a bit surprised,
as it required a otherwise conforming program to #undef _Noreturn
in order to use the _Noreturn
keyword as a function
specifier. The macro in this case was expanding to a gcc like
attribute syntax recognized by the compiler.Suggested Technical Corrigendum
Replace the first two bullets under 7.1.3p1 with:
— All identifiers that begin with an underscore and either an
uppercase letter or another underscore are always reserved for any use, except those identifiers
which are lexically identical to keywords. footnote)
— All identifiers that begin with an underscore are always
reserved for use as identifiers with file scope in both the ordinary
and tag name spaces,
except those identifiers which are lexically identical to keywords.
footnote) Allows identifiers spelled with a leading underscore followed by an uppercase letter that match the spelling of a keyword to be used as macro names.