...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <cinttypes> // for std::int_fast16_t void f(std::int_fast16_t val) { enum { BUFSIZE = 80 }; // ... } |
Exceptions
DCL32DCL51-CPP-EX1: For compatibility with other compiler vendors or language standard modes, it is acceptable to create a macro identifier the same as a reserved identifier so long as the behavior is idempotent, as in this example:
Code Block | ||||
---|---|---|---|---|
| ||||
// Sometimes generated by configuration tools such as autoconf #define const const // Allowed compilers with semantically equivalent extension behavior #define inline __inline |
DCL32DCL51-CPP-EX2: 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 in headers included by a standard library header, as in this example declaration from the libc++ STL implementation:
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
SEI CERT C Coding Standard | DCL37-C. Do not declare or define a reserved identifier PRE06-C. Enclose header files in an inclusion guard |
MISRA 08 | Rule 17-0-1 |
...