I continue to be amazed at the number of bizarre things you can arrange to do using the C preprocessor, the switch statement, and a strong stomach. I've previously used the combination to implement
coroutines, of course, and also a
modified version of for which performs its test after the loop body rather than before it.
Chris mentioned to me this
(
Read more... )
Comments 3
Your use of if(0) is rather better than the tawdry use I sometimes make of the Java equivalent, if(false) - the Java compiler complains of unreachable code, and sometimes when you're working on something, it's nice to suppress that with an if(false) return;. Of course, Java is boring and won't let you jump into blocks with a case: like that...
Reply
I didn't know it was actually illegal in Java, though! Or do you just mean that Java doesn't let you put case statements in sub-blocks in general rather than that it specifically disallows them in otherwise unreachable ones?
Reply
Reply
Leave a comment