Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor edits

...

Noncompliant Code Example

In this noncompliant code example, variables are defined with names reserved for the implementation.

...

Noncompliant Code Example (Header Guard)

A common but non-compliant noncompliant practice is to choose a reserved name for a macro used in a preprocessor conditional guarding against multiple inclusion of a header file. See also PRE06-C. Enclose header files in an inclusion guard. The name may clash with reserved names defined by the implementation of the C standard library in its headers, or with reserved names implicitly predefined by the compiler even when no C standard library header is included.

...

Compliant Solution (Header Guard)

The This compliant solution avoids using leading or trailing underscores in the name of the header guard.

...

Noncompliant Code Example (Global Variable)

In this noncompliant code example, a variable beginning with an underscore is defined with implicit global scope.

...

This code might have been safe if the C file containing it includes no header files. However, it requires that the header stddef.h be included in order to define size_t. Including any standard header files will introduce a potential name clash. Consequently it is not safe to prepend any identifier with an underline, even if its usage is confined to a single file.

...