This code would happily compile under VC++ 6.0 or lower. But this code is in violation of C++ standards which explicitly state that the scope of the loop control variable i is limited to within the loop, after which it is destroyed.

This rule has been correctly implemented from VC++ 7.0 onwards. It is also correctly implemented in gcc. So if you're migrating a project from VC++ 6.0 to 7.0 or to gcc, this discrepancy will cause compilation errors.