...
Code Block | ||||
---|---|---|---|---|
| ||||
#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
Tool | Version | Checker | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Section | |
| Section | 243 S Section | | Fully Implemented sectionimplemented | ||||||
| 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"
...