Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

C6294

warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed

This warning indicates that a for-loop cannot be executed because the terminating condition is true. This warning suggests that the programmer's intent is not correctly captured.

The following sample code generates this warning because MAX_VALUE is 0:

#define MAX_VALUE 0
void f()
{
  int i;
  for (i = 0; i < MAX_VALUE; i++)
  {
    // code 
  }
}

The following sample code corrects this warning by changing the value of MAX_VALUE to 25

#define MAX_VALUE 25
void f()
{
  int i;
  for (i = 0; i < MAX_VALUE; i++)
  {
    // code 
  }
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.