MISRA C:2012 Rule 8.2
Function types shall be in prototype form with named parameters
Description
Rule Definition
Function types shall be in prototype form with named parameters1 .
Rationale
The rule requires that you specify names and data types for all the parameters in a declaration. The parameter names provide useful information regarding the function interface. A mismatch between a declaration and definition can indicate a programming error. For instance, you mixed up parameters when defining the function. By insisting on parameter names, the rule allows a code reviewer to detect this mismatch.
Polyspace Implementation
The rule checker shows a violation if the parameters in a function declaration or definition are missing names or data types.
Additional Message in Report
Too many arguments to
function_name
.Too few arguments to
function_name
.Function types shall be in prototype form with named parameters.
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 R2014b
See Also
MISRA C:2012 Rule 8.1
| MISRA C:2012 Rule 8.4
| MISRA C:2012 Rule 17.3
| Check MISRA C:2012 (-misra3)
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.