Versions Compared

Key

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

According to the C standard, Section 7.1.3 [ISO/IEC 9899:2011],

  • All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.
  • 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.
  • Each macro name in any of the following subclauses (including the future library directions) is reserved for use as specified if any of its associated headers is included, unless explicitly stated otherwise.
  • All identifiers with external linkage (including future library directions) and errno are always reserved for use as identifiers with external linkage.
  • Each identifier with file scope listed in any of the following subclauses (including the future library directions) is reserved for use as a macro name and as an identifier with file scope in the same name space if any of its associated headers is included.

No other identifiers are reserved. (Note that the POSIX® standard extends the set of identifiers reserved by the C standard to include an open-ended set of its own. See section Section 2.2 Compilation Environmentenvironment in IEEE Std 1003.1-2008.) The behavior of a program that declares or defines an identifier in a context in which it is reserved, or defines a reserved identifier as a macro name, is undefined. See also undefined behavior 106  in Annex J of the C standard. Trying to define a reserved identifier can result in its name conflicting with that used in implementation, which may or may not be detected at compile time.

...

a macro definition of errno is suppressed in order to access an actual object, or the program defines an identifier with the name errno. [ISO/IEC 9899:2011]

(See undefined behavior 114  of Annex J.)

...

CERT C++ Secure Coding Standard: DCL32-CPP. Do not declare or define a reserved identifier

ISO/IEC 9899:2011 Section  Section 7.1.3, "Reserved Identifiersidentifiers"

Bibliography

[IEEE Std 1003.1-2008] Section 2.2 "The compilation environment"

...