Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added an exception about library function declarations (without definitions).

...

Such macros should only be used with great care. See rules PRE31-C. Avoid side effects in arguments to unsafe macros and PRE00-C. Prefer inline or static functions to function-like macros for more information.

DCL37-EX2: Provided that a library function can be declared without reference to any type defined in a header, it is permissible to declare that function without including its header as long as that declaration is compatible with the standard declaration.

Code Block
bgColor#ccccff
langc
/* Not including stdlib.h */
void free(void *);
 
void func(void *ptr) {
  free(ptr);
}

Such code is compliant because the declaration matches what stdlib.h would provide and does not redefine the reserved identifier.  It would not be acceptable to provide a definition for the free() function in the above example.

Risk Assessment

Using reserved identifiers can lead to incorrect program operation.

...