Title
Use of predefined reserved identifiers
Status
tentatively ready
Section
5.10 [lex.name]
Submitter
Jiang An

Created on 2023-01-18.00:00:00 last changed 2 months ago

Messages

Date: 2024-03-20.14:10:31

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.
Date: 2024-03-20.14:10:31

CWG 2024-03-20

The exceptions should not be specified using a specific list, which might become stale in the future.

Date: 2024-03-20.06:35:31

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
  • Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
Date: 2023-12-16.00:18:01

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-03-20 14:10:31adminsetmessages: + msg7650
2024-03-20 06:35:31adminsetmessages: + msg7647
2024-01-21 13:30:12adminsetstatus: review -> tentatively ready
2023-12-16 00:18:01adminsetmessages: + msg7557
2023-12-16 00:18:01adminsetstatus: open -> review
2023-01-18 00:00:00admincreate