Versions Compared

Key

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

...

Code Block
bgColor#ccccFF
langc

#ifndef HEADER_H
#define HEADER_H

/* ... contents of <header.h> ... */

#endif /* HEADER_H */

...

Because solutions such as this one make it possible to create a header file that can be included more than once, the C standard [ISO/IEC 9899:19992011] guarantees that the standard headers are safe for multiple inclusion.

Note that it is a common mistake to choose a reserved name for the name of the macro used in the inclusion guard. See rule DCL37-C. Do not declare or define a reserved identifier.

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

PRE06-C

low

unlikely

low

P3

L3

Automated Detection

LDRA tool suite

243 S

Fully Implementedimplemented
ToolVersionCheckerDescription
Section
Include Page
LDRA_V
LDRA_V
Section
Section
Fully Implemented sectionimplemented

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V
section

inclgard

Section

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...

CERT C++ Secure Coding Standard: PRE06-CPP. Enclose header files in an inclusion guard

ISO/IEC 9899:19992011 Section 6.10, "Preprocessing directives," Section 5.1.1, "Translation environment," and Section 7.1.2, "Standard headers"

...