MISRA C:2012 Rule 8.3
All declarations of an object or function shall use the same names and type qualifiers
Description
Rule Definition
All declarations of an object or function shall use the same names and type qualifiers1 .
Rationale
Consistently using parameter names and types across declarations of the same object or function encourages stronger typing. It is easier to check that the same function interface is used across all declarations.
As exceptions:
Using compatible versions of the same basic type does not violate this rule. For example, you can use
signed
,int
, andsigned int
interchangeably.Using unnamed function parameters does not violate this rule. For instance, use the declaration
void foo(int a)
interchangeably with the declarationvoid foo(int)
.
Polyspace Implementation
The rule checker detects situations where parameter names or data types are different between multiple declarations or the declaration and the definition. The checker considers declarations in all translation units and flags issues that are not likely to be detected by a compiler.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Declarations and Definitions |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2014bSee Also
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace® Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.