Things Have History
C, or the language that gave Unix a skeleton

programming-languages

C, or the language that gave Unix a skeleton

Listen · 4:15

When Bell Telephone Laboratories acquired a PDP-11 minicomputer in 1971, it broke something. Not the machine — the machine was fine. What broke was B, the compact language Ken Thompson had written two years earlier to build Unix on a PDP-7. The PDP-11’s architecture was byte-addressable: its memory organized in 8-bit units, not machine words. B treated everything as a word. The mismatch was fundamental, and it fell to Dennis Ritchie to fix it.

Ritchie had joined Bell Labs’ Computing Sciences Research Center in Murray Hill, New Jersey, in 1967. His father had worked at the same laboratory — Bell Labs was, for the Ritchies, practically a family trade. By 1971 Dennis was deep in the Unix project, which Thompson had begun in 1969 on hardware so modest the rest of the lab had largely abandoned it. Unix worked, but writing it in B meant living without types: every variable was a machine word, the compiler had no idea whether a given chunk of memory held a character, an integer, or a pointer to something else. On the PDP-7 this was acceptable. On the PDP-11 it was not.

Ritchie’s first move was modest: he added a character type to B, calling the interim result NB — New B. Then he kept going. Through 1972, he added integers, structs, and a cleaner model for pointers, wrote a new compiler, and renamed the language C.

The naming is a quiet joke embedded in computing history. B had descended from BCPL — the Basic Combined Programming Language, designed by Martin Richards at Cambridge in 1967. Thompson simplified BCPL into B; Ritchie extended B into C. When a systems language called D arrived in 2001, it merely acknowledged a chain whose logic had begun in a Cambridge basement.

The test came in 1973. Thompson and Ritchie rewrote the Unix kernel in C; Version 4 Unix, released in November 1973, was the first Unix with a C core. The practical consequence was portability. An operating system written in assembly language is pinned to one chip’s instruction set; move to new hardware and you translate the whole thing by hand. An operating system written in C runs on any new machine as soon as someone writes a C compiler for it. Unix became, for the first time, an OS that could move. It spread to universities, government laboratories, and eventually the commercial world — carrying C with it.

In 1978, Ritchie and Bell Labs colleague Brian Kernighan published The C Programming Language. At 272 pages it was thin by the standards of language manuals, and it opened with a four-line program that printed the words hello, world to a terminal. That program became the first thing generations of programmers learned to type. The book served as the de facto language standard for a decade; when ANSI finally codified C in 1989, the committee was largely formalizing what Kernighan and Ritchie had already set down.

C went on to underlie Unix, Linux, and Windows NT. C++ is C with classes. Objective-C is C with Smalltalk’s message-passing attached. The virtual machines that run Java, Python, and JavaScript are themselves written in C. The language Ritchie built to fix a type problem on a laboratory minicomputer became the substrate on which most of the software world was poured.

Thompson named his language B. Ritchie added types and called it C. The languages that came after — and the systems they run on — are still being built from the same blueprint.

Sources

Spot a mistake?

Wrong date, broken citation, a fact that doesn't hold? Tell us. It lands in an inbox a human reads and the post can be pulled or corrected.