MISRAC++2023-0.2.2_a
In this section:
Synopsis
(Required) A named function parameter shall be used at least once
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
A function parameter is declared but not used. This check is identical to MISRAC++2008-0-1-11.
Coding standards
- CWE 563
Unused Variable
- MISRA C++ 2008 0-1-11
(Required) There shall be no unused parameters (named or unnamed) in nonvirtual functions.
Code examples
The following code example fails the check and will give a warning:
int example(int x) {
/* `x' is not used */
return 20;
}
The following code example passes the check and will not give a warning about this issue:
int example(int x) {
return x + 20;
}