[previous] 3340 [next] Floating point variable used as 'for' loop control variable.
Control flow

The variable identified as the the loop control variable in this 'for loop' is of floating type.

QA·C identifies a loop control variable 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 ++*/

/*PRQA S 2017,3121,3132,3227,3408,3447 ++*/

extern float ftbuf[100];

extern void foo(float ftx, float fty)
{
  float ft;
  int   i;

  for (i = 0; ftbuf[i] > 0.0F; ++i)                   /* Message 3342 */
  {
    /* ... */
  }

  for (ft = 0.0F; ft < ftx; ft = ft + fty)            /* Message 3342 and 3340 */
  {
    /* ... */
  }
}

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