[previous] 0883 [next] Include file code is not protected against repeated inclusion
Preprocessing

The code in this included file does not appear to be protected against repeated inclusion

Different strategies may be used when developing a well structured set of include files and sometimes it is difficult to avoid a situation where the same file is included more than once in the same translation unit. In order to guard against such an eventuality, it is customary to surround the content of the include file with preprocessing directives which prevent the content from being preprocessed more than once.

Message 0883 is generated when the structure of an included file does not conform to one of the conventional ways in which this kind of protection is implemented. Various forms are recognized by QAC; the most common form is:

#ifndef HFILEX_H
#define HFILEX_H
...
...
#endif


MISRA C:2012 Rules applicable to message 0883:

Dir-4.10  (Required) Precautions shall be taken in order to prevent the contents of a header file being included more then once


QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents