Versions Compared

Key

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

...

Code Block
bgColor#ccccff
langcpp
#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
bgColor#ccccff
langcpp
// 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

...