The reason I declared the iterator or control variable outside of the for-statement is because MSVC complained (at least for MSVC 2008) if I have two for-loops stacked together using the same CV, like:
if (int i = 0; ...) {
// loop 1
}
if (int i = 0; ...) {
// loop 2
}
The compiler would complain "i" was declared multiple times. Very annoying.
As I just tested, VS 2015 has no issue with the above code any more. So yes we couldn't rewrite some of the code as compilers getting smarter. But changing the code for the sake of readability is not the most urgent thing. We could make the code base more readable by other means, such as add/correcting comments.
-Xuejun