A figure at a desk with a typewriter studies a tall ladder of logical steps sketched across the wall of a quiet study.

Original artwork, not a still

Donald Knuth

Beware of bugs in the above code; I have only proved it correct, not tried it.

Behind the line

What it means

Our interpretation.

It is the programmer's version of a mathematician's joke: a proof shows the idea is sound, but only a running machine shows you the typo, the off-by-one and the forgotten edge case. Knuth, who paid reward cheques for bugs found in his books, made the warning famous. It now turns up in code comments, conference slides and sign-offs wherever someone shares code they have reasoned about but never executed.

Context reviewed

In context

May contain spoilersShow the scene

Donald Knuth wrote the line as the closing sentence of a five-page memo titled "Notes on the van Emde Boas construction of priority deques: An instructive use of recursion". He sent it on March 29, 1977, to the Dutch computer scientist Peter van Emde Boas, with copies to Bob Tarjan and John Hopcroft. The memo described a data structure that Knuth had worked out on paper rather than run, so the final sentence warned readers that the code had only been proved correct, never tried.

Sources (2)

Context reviewed

Share this quote