Previous Table of Contents Next


Part II
C

2  The Development of the C Language
3  C Programming

Chapter 2
The Development of the C Language1


1Copyright 1993 Association for Computing Machinery, Inc. This reprint made available by the author as a courtesy. For further publication rights, contact ACM or the author. This article was presented at the Second History of Programming Languages conference, Cambridge, MA, April 1993.

by Dennis M. Ritchie

2.1. Introduction

This chapter details the development of the C programming language, the influences on it, and the conditions under which it was created. For the sake of brevity, I omit full descriptions of C itself, its parent B (Johnson & Kernighan, 1973), and its grandparent BCPL (Richards & Whitbey-Strevens, 1979) and instead concentrate on characteristic elements of each language and how they evolved.

C came into being in the years 1969–1973, in parallel with the early development of the UNIX operating system; the most creative period occurred during 1972. Another spate of changes peaked between 1977 and 1979, when portability of the UNIX system was being demonstrated. In the middle of this second period, the first widely available description of the language appeared: The C Programming Language, often called the white book or K&R (Kernighan & Ritchie, 1978). Finally, in the mid-1980s, the language was officially standardized by the ANSI X3J11 committee, which made further changes. Until the early 1980s, although compilers existed for a variety of machine architectures and operating systems, the language was almost exclusively associated with UNIX. More recently, its use has spread more widely, and today, it is among the languages most commonly used throughout the computer industry.

2.2. History

2.2.1. The Setting

The late 1960s were a turbulent era for computer systems research at Bell Laboratories (Kernighan & Ritchie, 1978; Ritchie, 1984). The company was pulling out of the Multics project (Organick, 1975), which had started as a joint venture of MIT, General Electric, and Bell Labs. By 1969, Bell Labs management, and even the researchers, came to believe that the promises of Multics could be fulfilled only too late and too expensively. Even before the GE-645 Multics machine was removed from the premises, an informal group, led primarily by Ken Thompson, had begun investigating alternatives.

Thompson wanted to create a comfortable computing environment constructed according to his own design, using whatever means were available. His plans, it is evident in retrospect, incorporated many of the innovative aspects of Multics, including an explicit notion of a process as a locus of control, a tree-structured file system, a command interpreter as user-level program, simple representation of text files, and generalized access to devices. They excluded other aspects of Multics, such as unified access to memory and to files. At the start, he and the rest of us deferred another pioneering (although not original) element of Multics, namely writing almost exclusively in a higher-level language. PL/I, the implementation language of Multics, was not much to our tastes, but we were also using other languages, including BCPL, and we regretted losing the advantages of writing programs in a language above the level of assembler, such as ease of writing and clarity of understanding. At the time, we did not put much weight on portability; interest in this arose later.

Thompson was faced with a hardware environment cramped and spartan even for the time: The DEC PDP-7 on which he started in 1968 was a machine with 8KB 18-bit words of memory and no software useful to him. Although he wanted to use a higher–level language, he wrote the original UNIX system in PDP-7 assembler. Initially, he did not even program on the PDP-7 itself but instead used a set of macros for the GEMAP assembler on a GE-635 machine. A postprocessor generated a paper tape readable by the PDP-7.

These tapes were carried from the GE machine to the PDP-7 for testing until a primitive UNIX kernel, an editor, an assembler, a simple shell (command interpreter), and a few utilities (such as the UNIX rm, cat, and cp commands) were completed. After this point, the operating system was self-supporting: Programs could be written and tested without resort to paper tape, and development continued on the PDP-7 itself.

Thompson’s PDP-7 assembler simplified even DEC’s in that it evaluated expressions and emitted the corresponding bits. There were no libraries and no loader or link editor: The entire source of a program was presented to the assembler, and the output file with a fixed name that emerged was directly executable. (This name, a.out, explains a bit of UNIX etymology; it is the output of the assembler. Even after the system gained a linker and a means of specifying another name explicitly, it was retained as the default executable result of a compilation.)

Not long after UNIX first ran on the PDP-7, in 1969, Doug McIlroy created the new system’s first higher–level language: an implementation of McClure’s TMG (McClure, 1965). TMG is a language for writing compilers (more generally, transmogrifiers) in a top-down, recursive-descent style that combines context–free syntax notation with procedural elements. McIlroy and Bob Morris had used TMG to write the early PL/I compiler for Multics.

Challenged by McIlroy’s feat in reproducing TMG, Thompson decided that UNIX—possibly it had not even been named yet—needed a system programming language. After a rapidly scuttled attempt at Fortran, he created a language of his own, which he called B. B can be thought of as C without types; more accurately, it is BCPL squeezed into 8KB of memory and filtered through Thompson’s brain. Its name most probably represents a contraction of BCPL, although an alternate theory holds that it derives from Bon (Thompson, ca. 1969), an unrelated language created by Thompson during the Multics days. Bon in turn was named either after his wife Bonnie or (according to an encyclopedia quotation in its manual) after a religion whose rituals involve the murmuring of magic formulas.


Previous Table of Contents Next