[previous] 2877 [next] This loop will never be executed more than once.
Control flow

This loop will only be executed once and so the loop mechanism is redundant. Has there been a mistake ?

For example:


/*PRQA S 2017,2465,2467,3120,3227,3408 ++*/
void foo(void)
{
    int i;
    
    for (i = 0; i < 1; ++i)             /* 2877 */
    {
    }
    

    i = 10;

    while (i <= 10)                     /* 2877 */
    {
        ++i;
    }
    
}


MISRA C:2012 Rules applicable to message 2877:

Dir-4.1  (Required) Run-time failures shall be minimized


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