[previous] 2980 [next] The value of this function parameter is never used before being modified.
Redundancy

The value passed in this function parameter is always modified before being used and so the parameter is effectively redundant. Is this really intended ?

For example:


/*PRQA S 2017,2986,3195,3203,3227,3408 ++*/

int foo(int n, int x)    /* 2980 */
{
    n = x + 1;

    return n;
}


MISRA-C:2004 Rules applicable to message 2980:

Rule  21.1  (Required) Minimisation of run-time failures shall be ensured by the use of at least one of (a) static analysis tools/techniques; (b) dynamic analysis tools/techniques; (c) explicit coding of checks to handle run-time faults


QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents