![]() |
![]() |
3447 | ![]() |
||||
![]() | |||||||
| Declarations and Definitions | |||||||
An object or function is being declared with external linkage and the declaration is not located in a header file. When an item has external linkage, it can usually be assumed that it will be accessed from more than one translation unit. In order to ensure consistency between definition and usage, it is conventional to implement a single declaration located in a header file and for the header file to be included in the translation unit where the item is defined as well as in every translation unit where the item is used.
/*PRQA S 2017,3211,3603 ++*/
extern int gv1 = 0; /* Message 3408 */
extern int gv2; /* Message 3447 */
int gv2 = 0;
extern void foo1(void) /* Message 3408 */
{
}
extern void foo2(void); /* Message 3447 */
extern void foo2(void)
{
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |