Dave Angel <da...@ieee.org> wrote: > 2) In original C, and I think in C++, the lifetime of i lasted long > after the loop ended. > for (int i=0; i< limit; ++i) > { > z += i; > } > i is still valid after this curly brace > > In C99, and at least in later C++, the scope of i ends with the curly, > as though there were another invisible pair of braces: > { > for (int i=0; i< limit; ++i) > { > z += i; > }} > i is no longer valid here >
Leading to the wonderful header declaration: #define for if(0);else for which moves the entire for loop including the declaration inside another statement and therefore 'fixes' the variable scope for older compilers. Ah, those were the days. :^) -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list