TIL that in the C `switch` statement, the `default` clause doesn't have to be the last one. (It still runs when no other options match including ones declared below it.)
@bugaevc hah, yeah! C's switch has so many surprises...
@bugaevc And that can change semantics because of fallthrough, right?
@hirnbrot ha, haven't thought of that! I guess so.
case A: … break;
case B: … break;
case C: … break;
If you drop down a level, they're basically value-labeled goto targets and the switch is basically a branch table, which is congruent with the syntax (and sometimes with the output!), and is also “why” “fallthrough” is a thing in the first place: the labels aren't blocks.
@bugaevc That's both insane and potentially useful. :)
Same is true for java switch.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!