This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Something weird with cp/decl.c switch statement


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]