[previous] 2981 [next] This initialization is redundant. The value of this object is never used before being modified.
Redundancy

The initialisation performed when this object is defined appears to be redundant because the value of the object is not used before being modified by assignment.

For example:


/*PRQA S 2017,3197,3408 ++*/

int foo(void)
{
    int carno = 0;              /* 2981 */

    carno = 1;

    return carno;
}


MISRA C:2012 Rules applicable to message 2981:

Rule-2.2  (Required) There shall be no dead code


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