Compartilhar via


PREfast Warning 294 (Windows CE 5.0)

Send Feedback

294 - Ill-defined for-loop.
Additional Information: Initial condition does not satisfy test.

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

The for-loop:

     for (initializer; continuation; increment ) {
          ...
          }

is equivalent to the following:

     {
          initializer;
          while (continuation) {
          ...
              increment;
          }
     }

Thus, if initializer does not satisfy continuation, the loop body is not executed.

The consequence of this error is that the body is not executed.

Example

Defective Source

signed char i;

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

Corrected Source

signed char i;

for (i = 0; i < 100; i++) { ; }

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.