Neil Booth wrote:
> Argiris Kirtzidis wrote:-
>
>
>> I think this is more explicit:
>>
>> // C++ 3.3.2p4:
>> // Names declared in the for-init-statement, and in the condition
>> of if,
>> // while, for, and switch statements are local to the if, while,
>> for, or
>> // switch statement (including the controlled statement).
>>
>> Should I replace the "C++ 6.4p3" quote, with the above one ?
>>
>
> I don't think it adds anything - it doesn't say a new scope is
> created.
>
But it says that for your example:
void f(void)
{
int x; #1
if (int x = 1) #2
{
}
}
#2 is local to the if statement, so it doesn't collide with #1.
3.3.2p4 says that #2 is local to the if statement, and 6.4p3 says that #2 goes
out of scope when the if statement finishes.
Are you suggesting that we handle these requirements for #2 without entering a
new scope ?
-Argiris
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits