Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The C++ Standard, [reserved.names], specifies the following rules regarding reserved names  [ISO/IEC 14882-2014], specifies the following rules regarding reserved names:

  • A translation unit that includes a standard library header shall not #define or #undef names declared in any standard library header.
  • A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 3, or to the attribute-tokens described in 7.6.
  • Each name that contains a double underscore __ or begins with an underscore followed by an uppercase letter 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.
  • Each name declared as an object with external linkage in a header is reserved to the implementation to designate that library object with external linkage, both in namespace std and in the global namespace.
  • Each global function signature declared with external linkage in a header is reserved to the implementation to designate that function signature with external linkage.
  • Each name from the Standard C library declared with external linkage is reserved to the implementation for use as a name with extern "C" linkage, both in namespace std and in the global namespace.
  • Each function signature from the Standard C library declared with external linkage is reserved to the implementation for use as a function signature with both extern "C" and extern "C++" linkage, or as a name of namespace scope in the global namespace.
  • For each type T from the Standard C library, the types ::T and std::T are reserved to the implementation and, when defined, ::T shall be identical to std::T.
  • Literal suffix identifiers that do not start with an underscore are reserved for future standardization.

The identifiers and attribute names mentioned above names referred to in the preceding excerpt are overridefinalalignascarries_dependencydeprecated, and noreturn.

...

In this noncompliant code example, because the C++ standard template library header <cinttypes> is specified to include <cstdint>, as per [c.files] paragraph 4[ISO/IEC 14882-2014], the name MAX_SIZE conflicts with the name of the <cstdint> header macro used to denote the upper limit of std:size_t:

...