![]() |
![]() |
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:2012 Rules applicable to message 3451:
| Rule-8.5 (Required) | An external object or function shall be declared once in one and only one file |
![]() | ||
| 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 |