[previous] 2986 [next] This operation is redundant. The value of the result is always that of the right-hand operand.
Redundancy

This operation appears to be redundant because the right-hand operand can always be used instead.

For example:


/*PRQA S 2017,2983,3198,3203,3408,3447 ++*/

void foo(unsigned int i, unsigned int j)
{
    0 | j;             /* 2986 */

    0xFFFFFFFFu & j;   /* 2986 */

    int k = 1;
    k * j;             /* 2986 */
}


MISRA-C:2004 Rules applicable to message 2986:

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