Tony Hoare: Invention of the null-reference a billion dollar mistake


Computing Pioneer Sir Charles Antony Richard Hoare (aka C.A.R. Hoare) was mostly known for his Quicksort algorithm, but less remembered for the idea of the “null-reference”. He noted in 2009 that it was his “billion-dollar mistake” which he regretted and only implemented it because it was so easy to do:

I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn’t resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. In recent years, a number of program analysers like PREfix and PREfast in Microsoft have been used to check references, and give warnings if there is a risk they may be non-null. More recent programming languages like Spec# have introduced declarations for non-null references. This is the solution, which I rejected in 1965.

Lessons learned: Regardless how tempting, stick to the problems you are trying to solve and avoid implementing things which who knows may come in handy. If there isn’t a clear use-case chances are these features will come back to bite you!

Here is a funny video illustrating how Quicksort works (without segmentation faults) using Hungarian folk dance:

https://www.youtube.com/watch?v=ywWBy6J5gz8

Joachim Bauernberger
Passionate about Open Source, GNU/Linux and Security since 1996. I write about future technology and how to make R&D faster. Expatriate, Entrepreneur, Adventurer and Foodie, currently living near Nice, France.

Valbonne Consulting provides Research & Consulting for emerging technologies in Internet/Web of Things (WoT/IoT/M2M) and Emerging-Tech. We specialise in decentralisation, security and privacy. We work across a variety of traditional industry verticals (Telecommunications, Automotive, Energy, ...). We support Open Source and technologies built on open standards.

One thought on “Tony Hoare: Invention of the null-reference a billion dollar mistake

Leave a Reply

Your email address will not be published. Required fields are marked *