![]() |
![]() |
3451 | ![]() |
||||
![]() | |||||||
| Declarations and Definitions | |||||||
An object or function has been declared in more than one file within this translation unit. This should be avoided if at all possible because it becomes necessary to ensure that the declarations remain consistent, and this incurs a maintenance overhead. Ideally, an item with external linkage should be declared in a single header file which can be included in the translation units where the item is defined and referenced. In the following example, message 3451 is generated when the function printf() is declared in the main source file as well as in the standard header file "stdio.h".
/*PRQA S 553,2017,3447,3625 ++*/
#include <stdio.h>
extern int printf(const char *format, ...); /* Message 3451 */
MISRA-C:2004 Rules applicable to message 3451:
| Rule 8.8 (Required) | An external object or function shall be declared in one and only one file. |
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |