Breaking change: for scoping change – default is now: /Zc:forScope


Original Code:


//sample.cpp                      
int main() {                         
   for(int i = 0; i < 10; ++i);
   for(i = 0; i < 10; ++i) ;   
}
                                                                               


Error VC2005 issues:


sample.cpp(3) : error C2065: 'i' : undeclared identifier


Code after applying the fix:


//sample.cpp
int main() {
 int i;
   for(i = 0; i < 10; ++i) ;
   for(i = 0; i < 10; ++i) ;
}


More information at http://msdn2.microsoft.com/en-us/library/84wcsx8x.aspx


Thanks,
 Ayman Shoukry



Comments (0)

Skip to main content