Nice

in which the laws of statistical inference turn out pretty nice

2026/03/25


I asked my good friend gpt-5.4-medium to write a little test for my CMake destroyer of a package manager. It was one step beyond cut-n-paste, and the machine politely obliged me. Test passed. Story’s over.

Wait, no! We must look at the code produced by the machines, for it is often fraught with the wringing of many hands. And this one confused me; I added globs, so you can do src/*.c, for example. The fixture it created had two C files in child directories, and then included them in the target by glob.

We do this all the time; write main.c such that it fails to compile if, say, the build system fails to append an include directory, or to link a library. It did the same thing here; each file had a function that was called in main. No glob, no source, linker complains, test fails. Looks good. Except these were the functions:

int post() {
  return 49;
}
int pre() {
  return 20;
}

Hmm? 49? 20? Surely there’s a simpler way. Hell, the functions don’t even need bodies. What the hell is it doing with these numbers? Well, there’s only one other file in the fixture, main.c:

int pre();
int post();

int main(int num_args, const char** args) {
  return pre() + post() == 69 ? 0 : 1;
}

Ah. Nice.