Created on 2023-01-18.00:00:00 last changed 4 months ago
Proposed resolution (approved by CWG 2024-03-20):
Change in 5.10 [lex.name] paragraph 3 and add bullets as follows:
In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter, other than those specified in this document (for example, __cplusplus (15.11 [cpp.predefined])), is reserved to the implementation for any use.
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
CWG 2024-03-20
The exceptions should not be specified using a specific list, which might become stale in the future.
Proposed resolution (approved by CWG 2024-01-19) [SUPERSEDED]:
Change in 5.10 [lex.name] paragraph 3 and add bullets as follows:
In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use, except for
- the macros specified in 15.11 [cpp.predefined],
- the function-local predefined variable (9.5.1 [dcl.fct.def.general]), and
- the macros and identifiers declared in the standard library as specified in Clause 17 [support] through Clause 33 [thread], and Clause Annex D [depr]. [ Note: This affects macros in 17.3.2 [version.syn], 31.13.1 [cstdio.syn], and D.11 [depr.c.macros] as well as identifiers in 17.2.2 [cstdlib.syn]. -- end note ]
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
[Accepted as a DR at the June, 2024 meeting.]
Subclause 5.10 [lex.name] paragraph 3 specifies:
In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use.
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
That implies that uses of standard-specified predefined macros (15.11 [cpp.predefined]) or feature-test macros (17.3.2 [version.syn]) make the program ill-formed. This does not appear to be the intent.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: ready -> dr |
2024-06-26 19:00:47 | admin | set | status: tentatively ready -> ready |
2024-03-20 14:10:31 | admin | set | messages: + msg7650 |
2024-03-20 06:35:31 | admin | set | messages: + msg7647 |
2024-01-21 13:30:12 | admin | set | status: review -> tentatively ready |
2023-12-16 00:18:01 | admin | set | messages: + msg7557 |
2023-12-16 00:18:01 | admin | set | status: open -> review |
2023-01-18 00:00:00 | admin | create |