VJ update:只判断private函数
Unused parameters for private method misleading. Whatever the values passed to such parameters, the behavior will be the same.
Noncompliant Code Example
private void doSomething(int a, int b) { // "b" is unused
compute(a);
}
Compliant Solution
private void doSomething(int a) {
compute(a);
}
Exceptions
The rule will not raise issues for protected or public methods
See
- MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
- MISRA C:2012, 2.7 - There should be no unused parameters in functions
- CERT, MSC12-C. - Detect and remove code that has no effect or is never
executed
- CERT, MSC12-CPP. - Detect and remove code that has no effect