Consider the following switch
statement:
switch( value )
{
case 1:
return 1;
default:
value++;
// fall-through
case 2:
return value * 2;
}
This code compiles, but is it valid (= defined behavior) for C90/C99? I have never seen code where the default case is not the last case.
EDIT:
As Jon Cage and KillianDS write: this is really ugly and confusing code and I am well aware of it. I am just interested in the general syntax (is it defined?) and the expected output.