[previous] 2741 [next] This 'if' controlling expression is a constant expression and its value is 'true'.
Invariant operations

The controlling expression in this 'if' statement is a constant expression with a non-zero (i.e. 'true') value. The statement is therefore effectively redundant because the code which immediately follows will always be executed.

For example:


/*PRQA S 2017,3120,3140,3227,3355,3358,3408 ++*/

#define CONFIG 5

void foo(void)
{
    if (CONFIG == 5)                       /* 2741 */
    {
        ;
    }
}

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents