Get the latest tech news
Weekend projects: getting silly with C
C is beautiful yet full of horrors. Here's to uncovering its hidden depths.
There’s plenty to admire about the winning IOCCC entries, but they’re usually not fun to study: they tend to rely on confusing preprocessor macros, nonsensical formatting, unhelpful variable names, and simple logic encoded in obtuse arithmetic expressions that need to be reverse-engineered back into normal code. Such switch (…) notation is unheard-of and never encountered in real life simply because it defeats the purpose: without angle brackets, you can only have one statement riding on the coattails. Note that in this example, you don’t need break statements to avoid fallthrough; the code unconditionally jumps to the appropriate case label, skipping over the preceding if (0); but once the relevant puts(…) is executed, all subsequent calls are gated behind the remaining, perpetually-false if (0) conditionals.
Or read this on Hacker News