Is using if (0) to skip a case in a switch supposed to work?
问题 I have a situation where I would like for two cases in a C++ switch statement to both fall through to a third case. Specifically, the second case would fall through to the third case, and the first case would also fall through to the third case without passing through the second case. I had a dumb idea, tried it, and it worked! I wrapped the second case in an if (0) { ... } . It looks like this: #ifdef __cplusplus # include <cstdio> #else # include <stdio.h> #endif int main(void) { for (int i