Share via


C6294

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Example

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   
  }  
}