[previous] 2743 [next] This 'do - while' loop controlling expression is a constant expression and its value is 'false'. The loop will only be executed once.
Invariant operations

The controlling expression in this 'do .. while' statement is a constant expression with a non-zero (i.e. 'true') value. The loop will only be executed once and is therefore not strictly a loop at all. However, constructs of this kind are sometimes defined in the replacement list of a macro as a way of embedding several statements within a macro which can then be used rather like a function.

For example:


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

void foo(void)
{
    do
    {
    } while (0);                    /* 2743 */
}


No MISRA C:2012 Rules applicable to message 2743


See also:

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