MISRA C:2023 Rule 8.3
All declarations of an object or function shall use the same names and type qualifiers
Since R2024a
Description
Rule Definition
All declarations of an object or function shall use the same names and type qualifiers.
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 R2024a