Well!
-
Well! I've definitely seen my share of "idiosyncratic" C styles omitting braces and exploiting corner cases in 30+ years of having to read other peoples' C code, but this is a new one.
I had not thought about what would happen if you left the braces off a switch. Because, of course, doing so would be utterly unhinged.
I give you: the world's most obtuse version of "if (x == A || x == b)", indistinguishable from an editing mistake.
-
Well! I've definitely seen my share of "idiosyncratic" C styles omitting braces and exploiting corner cases in 30+ years of having to read other peoples' C code, but this is a new one.
I had not thought about what would happen if you left the braces off a switch. Because, of course, doing so would be utterly unhinged.
I give you: the world's most obtuse version of "if (x == A || x == b)", indistinguishable from an editing mistake.
@cliffle that's my favorite way to print a comma-separated list
switch (i = 0, count) for (; i < count; ++i) {
printf(", ");
default:
printf("%d", elements[i]);
case 0:;
} -
@cliffle that's my favorite way to print a comma-separated list
switch (i = 0, count) for (; i < count; ++i) {
printf(", ");
default:
printf("%d", elements[i]);
case 0:;
}@joe this has strong Duff's Device energy.
-
-
@whitequark @cliffle with statement expressions, you can mix in UB from indefinite argument evaluation order and construct Duff's Russian Roulette
switch (rand())
foo(({ case 0: a; }), ({ case 1: b; }), ({ case 2: c; }), ...); -
@cliffle that's my favorite way to print a comma-separated list
switch (i = 0, count) for (; i < count; ++i) {
printf(", ");
default:
printf("%d", elements[i]);
case 0:;
} -
-
-
-
-
-
undefined Oblomov shared this topic on