Synopsis: | The content (body) of every header file shall be enclosed in #ifndef/#if !defined, #define and #endif. |
Language: | C |
Severity Level: | 2 |
Category: | Conceptual Models |
Description: |
Justification Since a header file may be used by source files and other header files, there is no way of knowing in which sequence header files will be included, nor how many times any particular header will be included. This mechanism resolves this sequencing and exclusive inclusion problem. Example #ifndef CCBB_FOO_H #define CCBB_FOO_H <body of header file CCBB_foo.h, which is the header file of CCBB_foo.c> #endif /* CCBB_FOO_H */ |