[previous] MISRA-C:2004  Rule  8.8:  (Required) [next] An external object or function shall be declared in one and only one file.
Normally this will mean declaring an external identifier in a header file, that will be included in any file where the identifier is defined or used. For example:

extern int16_t a;

in featureX.h, then to define a:

#include <featureX.h>
int16_t a = 0;

There may be one or there may be many header files in a project, but each external object or function shall only be declared in one header file.


QAC messages that encompass this guideline:

1513 Identifier '%1s' with external linkage has separate non-defining declarations in more than one location.
3222 Object with external linkage declared at block scope.
3408 '%s' has external linkage and is being defined without any previous declaration.
3447 '%s' is being declared with external linkage but this declaration is not in a header file.
3451 The global identifier '%s' has been declared in more than one 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