Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 1.12 KB

compiler-warning-level-4-c4289.md

File metadata and controls

29 lines (23 loc) · 1.12 KB
description title ms.date f1_keywords helpviewer_keywords
Learn more about: Compiler Warning (level 4, off) C4289
Compiler Warning (level 4, off) C4289
11/04/2016
C4289
C4289

Compiler Warning (level 4, off) C4289

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

When /Ze and /Zc:forScope- are used in a build, 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. For more information, see Compiler Warnings That Are Off by Default.

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