On Thu, Sep 4, 2008 at 09:33, Jason_Haynberg <haynberg@xxxxxxx> wrote: > This strikes me as a bug. What do you think? It seems the first program should get the same error as the second? > > for (int i = 0; i < 5; i++) { > cout << i << endl; > double i = 10.0; > cout << i << endl; > } > This is just intuition, but my understanding is that the double is defined inside the for loop body block, and the int is defined outside of it (it has to be, to persist its value), so there are 2 different scopes, so it's not an error. The analogous non-loop code would therefore be this, rather than what you posted: int i = 0; { cout << i << endl; double i = 10.0; cout << i << endl; } HTH, ~ Scott