by merraksh · 15y ago · 0 comments
void function(int x) {
switch (x) {
case 0: f0(); break;
case 1: f1(); break;
case 2: f2(); break;
case 3: f3(); break;
case 4: f4(); break;
case 5: f5(); break;
default:
}
}Section 6.8.4.2, item 5 of http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf (page 134)
(Pedantic note: It's technically incorrect to say that the switch statement does nothing.
switch(FunctionThatDoesSomethingAndReturns1()) {
case 2:
// foo
}
The switch body does nothing, but the actual statement does something.)