> for(int i = 0; i<10; i++)[color=blue]
> cout << i;
> for(int i = 0; i<20; i++)
> cout << i;
>
> It compiles and runs under gcc. However, when I give code like this to
> somebody who tries to run it under MSVC++6, it seems complains about
> redefinition of i, in the second loop...[/color]
MSVC6 is wrong in this case.
[color=blue]
> Is there a compiler option to set for MSVC++6 to accept this ?[/color]
This newgroup is about standard C++, compiler specific options are off
topic here. You are more likely to get a good peer reviewed answer if
you ask this question in a newsgroup dedicated to that particular
compiler such as news:microsoft.public.vc. See also
http://www.slack.net/~shiva/welcome.txt
<OT>
IIRC disabling language extensions (/Za option) will correct the
scoping problem, but unfortunately causes a lot of problems with header
files. Another fix is to use this macro: #define for if(1)
for
</OT>
HTH
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl