Hacker News new | ask | show | jobs
by cesarb 1264 days ago
The way "switch" works in C is very weird. It behaves more like a "goto", where each "case ...:" is a label to which it can jump.

So when the character is '-', it starts just before the "if (0)" (this part is hidden within the ARG_BEGIN macro), and as you noted, it will never enter that block. However, when the character is 'a', 'b', 'c', or nothing (the end-of-string marker), it will jump directly to the corresponding "case ...:" label, even though it's within that "unreachable" block.