...
Code Block | ||||
---|---|---|---|---|
| ||||
//* Sometimes generated by configuration tools such as autoconf */ #define const const //* Allowed compilers with semantically equivalent extension behavior */ #define inline __inline |
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:
Code Block | ||||
---|---|---|---|---|
| ||||
/*
The following declarations of reserved identifiers exists in the glibc implementation of
<stdio.h>. The original source code may be found at:
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=include/stdio.h;hb=HEAD
*/
# define __need_size_t
# include <stddef.h>
/* Generate a unique file name (and possibly open it). */
extern int __path_search (char *__tmpl, size_t __tmpl_len,
const char *__dir, const char *__pfx,
int __try_tempdir); |
Risk Assessment
Using reserved identifiers can lead to incorrect program operation.
...
CERT C Secure Coding Standard | PRE00-C. Prefer inline or static functions to function-like macros PRE06-C. Enclose header files in an inclusion guard PRE31-C. Avoid side effects in arguments to unsafe macros |
CERT C++ Coding Standard | DCL32DCL51-CPP. Do not declare or define a reserved identifier |
ISO/IEC TS 17961 | Using identifiers that are reserved for the implementation [resident] |
MISRA C:2012 | Rule 21.1 (required), Rule 21.2 (required) |
...