Commenters recognize the author as Simon Tatham, known to them for PuTTY and puzzle packs, and describe the switch-statement technique as amusing but hard to follow. Several see it as an example of code that is clever in the moment and opaque to anyone who did not write it. One commenter compares case labels to jumps into places that seem structurally impossible, while another argues that the code exposed a compiler bug: under the C specification, the program was valid, and the compiler’s shortcut for identifying unreachable code was at fault.
The comparison between switch cases and goto prompts disagreement. Some commenters say both are jumps in concept; others note that case labels only transfer control forward, unlike goto, which can jump backward too. One commenter distinguishes these restricted jumps from longjmp, the mechanism they associate with arguments against goto. Another argues that banning goto can force extra variables, duplicated code, or less efficient programs, and says restricted forward jumps can be useful. A commenter describes using goto in C to express loops whose entry point and condition do not fit the usual loop syntax, finding alternatives awkward and error-prone.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.