switch statement has the following syntax:
statement-switch:
switch (sw-expr)
{
case const-case-expr1:
statement-block *
[case const-case-expr2:
statement-block *
…
]
[default:
statement-block +
]
}
Important! Note that switch statement's block must not be followed by a ';' character!
switch statement is evaluated according to the following procedure:
struct A
{
BYTE type;
switch (type)
{
case 0:
int value;
break;
case 1:
double value;
break;
case 2:
string value;
break;
default:
$assert("Invalid file");
} // note: no ';' allowed here!
};