...
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 Portable Operating System Interface [POSIX®], Base Specifications, Issue 7, section Section 2.2, "The Compilation Environment" [IEEE Std 1003.1-2013].) The behavior of a program that declares or defines an identifier in a context in which it is reserved or that defines a reserved identifier as a macro name is undefined (see undefined behavior 106).
...
A common, but noncompliant, practice is to choose a reserved name for a macro used in a preprocessor conditional guarding against multiple inclusions of a header file. (see See also PRE06-C. Enclose header files in an inclusion guard.) . The name may clash with reserved names defined by the implementation of the C standard library in its headers or with reserved names implicitly predefined by the compiler even when no C standard library header is included.
...
In this noncompliant code example, the names of the file scope objects _max_limit
and _limit
both begin with an underscore. Because _max_limit
is static, this declaration might seem to be impervious to clashes with names defined by the implementation. However, because the header <stddef.h>
is included to define size_t
, a potential for a name clash exists. (Note, however, that a conforming compiler may implicitly declare reserved names regardless of whether any C standard library header is explicitly included.)
In addition, because _limit
has external linkage, it may clash with a symbol with of the same name defined in the language runtime library even if such a symbol is not declared in any header. Consequently, it is not safe to start the name of any file scope identifier with an underscore even if its linkage limits its visibility to a single translation unit.
...
In this noncompliant code example, because the C standard library header <inttypes.h>
is specified to include <stdint.h>
, the name SIZE_MAX
conflicts with a standard macro of the same name, used which is used to denote the upper limit of size_t
. In addition, although the name INTFAST16_LIMIT_MAX
is not defined by the C standard library, it is a reserved identifier because it begins with the INT
prefix and ends with the _MAX
suffix (see the C Standard, 7.31.10).
...
DCL37-C-EX2: For compatibility with other compiler vendors or language standard modes, it is acceptable to create a macro identifier the that is the same as a reserved identifier so long as the behavior is idempotent, as in this example:
...
DCL37-C-EX3: As a compiler vendor or standard library developer, it is acceptable to use identifiers reserved for your implementation. Reserved identifiers may be defined by the compiler, in standard library headers , or headers included by a standard library header, as in this example declaration from the glibc standard C library implementation:
...
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
|
|
| |||||||
ECLAIR |
| CC2.DCL37 | Fully implemented | ||||||
| 86 S, 218 S, 219 S, 580 S, 626 S | Fully Implemented | |||||||
Parasoft C/C++test | 9.5 | MISRA2004-20_1_a | Fully implemented | ||||||
Polyspace Bug Finder | R2016a | MISRA2012-RULE-21_1, MISRA2012 MISRA2012-RULE-21_2 | Partial | ||||||
PRQA QA-C |
| 0602, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608 | |||||||
SonarQube C/C++ Plugin |
| S978 |
...