X
Xavier Decoret
for (int i=0;i<10;++i)
{
int i = -1;
cout<<i<<endl;
}
As far as I understand, the int declaration in the for statement makes
it declared for the scope of the for loop. So it would not be possible
to declare another int i.
On gcc-3.2.3, the above code does compile and displays 10 lines of -1.
Is it a standard compliant behaviour?
--
+-------------------------------------------------+
| Xavier Décoret - Post Doct |
| Graphics Lab (LCS) - MIT |
| mailto: (e-mail address removed) |
| home : http://www.graphics.lcs.mit.edu/~decoret|
+-------------------------------------------------+
{
int i = -1;
cout<<i<<endl;
}
As far as I understand, the int declaration in the for statement makes
it declared for the scope of the for loop. So it would not be possible
to declare another int i.
On gcc-3.2.3, the above code does compile and displays 10 lines of -1.
Is it a standard compliant behaviour?
--
+-------------------------------------------------+
| Xavier Décoret - Post Doct |
| Graphics Lab (LCS) - MIT |
| mailto: (e-mail address removed) |
| home : http://www.graphics.lcs.mit.edu/~decoret|
+-------------------------------------------------+