...
In this noncompliant code example, the names of the file scope objects _max_limit
and _limit
both begin with an underscore. Because it is static
, the declaration of _max_limit
might seem to be impervious to clashes with names defined by the implementation. However, because the header <stddef.h>
is included in order 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 the same name defined in the language runtime library even if such a symbol is not declared in any header. Consequently, it is unsafe 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.
...
Such code is compliant because the declaration matches what stdlib.h
would provide and does not redefine the reserved identifier. However, it would not be acceptable to provide a definition for the free()
function in the preceding this example.
Risk Assessment
Using reserved identifiers can lead to incorrect program operation.
...