Title
Reserved names without library use
Status
cd4
Section
_N4140_.17.6.4.3.2 [global.names]
Submitter
Mike Miller

Created on 2014-02-26.00:00:00 last changed 94 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-10-15.00:00:00

Proposed resolution (October, 2014):

  1. Change 5.10 [lex.name] paragraph 3 as follows:

  2. In addition, some identifiers are reserved for use by C++ implementations and standard libraries (_N4140_.17.6.4.3.2 [global.names]) and shall not be used otherwise; no diagnostic is required.

    • Each identifier that contains a double understore __ 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.

  3. Change the footnote in 9.5.1 [dcl.fct.def.general] paragraph 8 as follows:

  4. [Footnote: Implementations are permitted to provide additional predefined variables with names that are reserved to the implementation (_N4140_.17.6.4.3.2 [global.names] 5.10 [lex.name]). If a predefined variable is not odr-used (6.3 [basic.def.odr]), its string value need not be present in the program image. —end footnote]
  5. Change the example in 12.6 [over.literal] paragraph 8 as follows:

  6.   double operator""_Bq(double);  // OK: does not use the reserved name identifier _Bq (_N4140_.17.6.4.3.2 [global.names] 5.10 [lex.name])
      double operator"" _Bq(double); // uses the reserved name identifier _Bq (_N4140_.17.6.4.3.2 [global.names] 5.10 [lex.name])
    
  7. Delete _N4140_.17.6.4.3.2 [global.names]:

  8. Certain sets of names and function signatures are always reserved to the implementation:

    • Each name that contains a double underscore __ or begins with an underscore followed by an uppercase letter (5.11 [lex.key]) is reserved to the implementation for any use.

    • Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.

Date: 2022-03-27.20:51:22

The section of the Standard reserving names that begin with two underscores or an underscore and a capital letter, _N4140_.17.6.4.3.2 [global.names], applies only to “programs that use the facilities of the C++ standard library” (16.4.5.1 [constraints.overview]). However, implementations rely on this restriction for mangling, even when no standard library facilities are used. Should this requirement be moved to the core language section?

(There is a related issue with user-defined literal suffixes, 16.4.5.3.6 [usrlit.suffix]. However, these are already mentioned normatively in the core language section, so it could be argued that the question of library usage does not apply.)

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5322
2014-11-24 00:00:00adminsetstatus: tentatively ready -> dr
2014-10-13 00:00:00adminsetmessages: + msg5146
2014-10-13 00:00:00adminsetstatus: drafting -> tentatively ready
2014-07-07 00:00:00adminsetstatus: open -> drafting
2014-02-26 00:00:00admincreate