![]() |
![]() |
2469 | ![]() |
||||
![]() | |||||||
| Control flow | |||||||
The variable identified as the control variable in this 'for' loop has been modified inside the body of the loop. QA·C identifies a control variable by examining the 3 'for-loop' expressions. Usually it is a variable in the 2nd expression and is the operand of a relational operator. In a conventional for loop, the loop control variable is only modified in the 3rd expression of the for statement. Modification in other places within the loop is likely to cause confusion. For example:
/*PRQA S 2017 ++*/
/*PRQA S 2017,3120,3199,3408 ++*/
extern void foo(void)
{
int j;
for (j = 0; j < 10; j++ )
{
++j; /* Message 2469 */
}
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |