MISRA C++:2023 Rule 0.2.2
Description
Rule Definition
A named function parameter shall be used at least once
Rationale
Unused parameters of a function can indicate programming errors or incomplete code. For instance, the parameter might be intended for an operation that you forgot to code.
Polyspace Implementation
The rule checker reports violations on unnamed unused parameters of a function except in the following cases:
The function has an empty body.
The function contains Assembly language instructions (which might be using the parameters).
The parameters are declared with the attribute
[[maybe_unused]]
.
If a rule violation is reported, the result details for the violation shows which function parameters are unused.
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: Language independent issues |
Category: Required |
Version History
Introduced in R2024b