[previous] MISRA-C:2004  Rule  8.5:  (Required) [next] There shall be no definitions of objects or functions in a header file.
Header files should be used to declare objects, functions, typedefs, and macros. Header files shall not contain or produce definitions of objects or functions (or fragments of functions or objects) that occupy storage. This makes it clear that only C files contain executable source code and that header files only contain declarations. A "header file" is defined as any file that is included via the #include directive, regardless of name or suffix.

Example Code:


#include "misra.h"
#include "m2cmex.h"
#include "rule_8.5.h"

extern S16 test_0805( void )
{
   return test_0805c();
}


QAC messages that encompass this guideline:

3406 Object/function '%s', with external linkage, has been defined in a header file.
3480 Object/function '%s', with internal linkage, has been defined in a header file.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents