![]() |
![]() |
2462 | ![]() |
||||
![]() | |||||||
| Control flow | |||||||
The variable initialised in the first expression of this 'for loop' does not appear to be the 'control variable'. The control variable is identified by examining the 3 'for-loop' expressions. Usually it is a variable in the 2nd expression which is the operand of a relational operator. For example:
/*PRQA S 2017,3120,3199,3203,3408 ++*/
extern void foo(void)
{
int j = 0;
int dummy;
for ( ; j < 10; j++) /* */
{
/* ... */
}
for (dummy=0; j < 20; j++) /* Message 2462 */
{
/* ... */
}
}
MISRA C:2012 Rules applicable to message 2462:
| Rule-14.2 (Required) | A for loop shall be well-formed |
![]() | ||
| 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 |