What does the C++ standard say with regards to the following piece of code. I am attempting to compile someone else's code on two different compilers, and on one it fails. The code is something like this:
The reason one fails is it says that i is defined twice (in both for statements). So the question I have is does defining a variable within a for loop limit the scope of the variable to the for loop? Or does it effectively define the variable in the scope before the loop? Which compiler is more compliant to the standard in this particular area?