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

Compiler Warning (level 4) C4289

Error Message

nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope

When compiling with /Ze and /Zc:forScope-, a variable declared in a for loop was used after the for-loop scope.

See /Zc:forScope for information about how to specify standard behavior in for loops with /Ze.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4289:

// C4289.cpp
// compile with: /W4 /Zc:forScope-
#pragma warning(default:4289)
int main() {
   for (int i = 0 ; ; )   // C4289
      break;
   i++;
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.