[previous] 2983 [next] This assignment is redundant. The value of this object is never subsequently used.
Redundancy

This assignment appears to be redundant because the value of the object is never used before the end of its lifetime.

For example:


/*PRQA S 2017,3199,3408,3447 ++*/

extern int y;
extern int z;

void foo(void)
{
    int x = 1;

    x = x + y + z;          /* 2983 */ /* redundant assignment - the value of x is never used */

    return;
}


MISRA-C:2004 Rules applicable to message 2983:

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