...
Code Block | ||
---|---|---|
| ||
#ifndef HEADER_H #define HEADER_H /* ... contents of the header<header.h> ... */ #endif /* HEADER_H */ |
Consequently, the first time that header.h
is #include
'd, all of its contents are included. If the header file is subsequently #include
'd again, its contents are bypassed.
Wiki Markup |
---|
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:1999|AA. C References#ISO/IEC 9899-1999]\] 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 DCL37-C. Do not use identifiers that are reserved for the implementation.
Risk Assessment
Failure to include header files in an inclusion guard can result in unexpected behavior.
...