Something weird with cp/decl.c switch statement
Aaron Gray
angray@beeb.net
Tue Jun 5 17:35:00 GMT 2007
> On 6/5/07, Aaron Gray <angray@beeb.net> wrote:
>> MS Visual Studio does not parse it. Are you sure its legal C ?
>
> Yes I am. Try this:
> int f(int a)
> {
> switch (a)
> {
> case 1:
> {
> int b = 2;
> break;
> case 2:
> break;
> }
> }
> }
>
> This is valid C90 and C99, though invalid C++98.
>
> If you are using visual studio, make sure it is being compiled as C
> and not C++. C++ is not a true superset of C; anyone who thinks needs
> to tell their CS teacher (or book author) that they are wrong and they
> should relearn about the two languages.
Your right :)
Aaron
More information about the Gcc
mailing list