MISRAC++2008-0-1-12 (C++ only)
In this section:
Synopsis
(Required) There shall be no unused parameters (named or unnamed) in the set of parameters for a virtual function and all the functions that override it.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
A function parameter is declared but not used. This check is identical to MISRAC++2023-0.2.2_b.
Coding standards
- CWE 563
Unused Variable
- MISRA C++ 2023 0.2.2
(Required) A named function parameter shall be used at least once
Code examples
The following code example fails the check and will give a warning:
struct S {
virtual int example(int a, int b) {
return a * a;
}
};
The following code example passes the check and will not give a warning about this issue:
struct S {
virtual int example(int a, int b) {
return a * b;
}
};