Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

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 
  }
}
Show:
© 2015 Microsoft