| Bluesky | @cfi.bsky.social |
| Bluesky | @cfi.bsky.social |
@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:;
}
since NYT games has revealed people like constraint solving, i figured i'd pitch them a struct packing game
it'll just cost them a copy of libclang - a measly half a gigabyte of text
@jonmsterling @olynch @AndrasKovacs I say play this card whenever and wherever you can. Parser: produce a parse tree with missing/partial syntax but as much structure as possible. Elaborator: Product a term with type holes. Codegen: Trap (ideally to a higher-level context like an editor or a debugger).
If you want to diagnose these things at compile time write a traversal that pretty-prints the holes.