MISRA C++:2008 Rule 8-4-2
The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration
Description
Rule Definition
The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration.1
Rationale
Using different identifiers in redeclarations can cause developer confusion. Using the same parameter identifiers in a function declaration and a function redeclaration helps make code easier to understand, maintain, and document.
Polyspace Implementation
The checker detects mismatch in parameter names between:
A function declaration and the corresponding function definition.
Two declarations of a function in the same file.
If the declarations occur in different files, the checker does not report a violation for mismatch in parameter names. Declaring the same function in different files is a violation of
MISRA C++:2008 Rule 3-2-3
.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Declarators |
Category: Required |
Version History
Introduced in R2013b
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.