[previous] 2462 [next] The variable initialized in the first expression of this 'for' statement is not the variable identified as the 'loop control variable' (%s).
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  */
  {
    /* ... */
  }

}

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