I just discovered the following section in some code I maintain:
switch (m) {
case 62: { // opening
// some declarations
// do some stuff
break;
case 63:
// do some other stuff
break;
} // closing
default:
// default stuff
break;
}
The block opening is meant to declaring some local variables, but the closing brace is wrongly placed and occurs after the case 63
.
I have never noticed this for months as it compiles well in Visual Studio 2010. I've tried debugging it and both cases work fine.
How can it be ? Is this correct C syntax ?