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

C6292

warning C6292: ill-defined for-loop: counts up from maximum

This warning indicates that a for-loop might not function as intended.

It occurs when a loop counts up from a maximum, but has a lower termination condition. This loop will terminate only after integer overflow occurs.

The following code generates this warning:

void f( )
{
   int i;

   for (i = 100; i >= 0; i++)
   {
      // code ...
   }
}

To correct this warning, use the following code:

void f( )
{
   int i;

  for (i = 100; i >= 0; i--)
   {
      // code ...
   }
}
Show:
© 2015 Microsoft