“A damn stupid thing to do”—the origins of C

By | December 9, 2020
As hard as it may be to believe, C was not simply born in wellworn paperback form.
Enlarge / As hard as it may be to believe, C was not simply born in wellworn paperback form.

In one form or another, C has influenced the shape of almost every programming language developed since the 1980s. Some languages like C++, C#, and objective C are intended to be direct successors to the language, while other languages have merely adopted and adapted C’s syntax. A programmer conversant in Java, PHP, Ruby, Python or Perl will have little difficulty understanding simple C programs, and in that sense, C may be thought of almost as a lingua franca among programmers.

But C did not emerge fully formed out of thin air as some programming monolith. The story of C begins in England, with a colleague of Alan Turing and a program that played checkers.

God Save the King

Christopher Strachey was known as the “person who wrote perfect programs,” as noted in a long profile from the journal, Annals of the History of Computing. It was a reputation he acquired at the Manchester University Computing Center in 1951. Strachey ended up there, working on the school’s Ferranti Mark I computer through an old King’s College, Cambridge, connection, Alan Turing.

Strachey was born in 1916 into a well-connected British family—his uncle, Lytton Strachey, was a founding member of the Bloomsbury Group, while his father, Oliver Strachey, was instrumental in Allied code-breaking activities during both World Wars.

That Strachey ended up being an acknowledged expert in programming and computer science would have come as something of a surprise to his public school and Cambridge University instructors. Strachey had always displayed a talent for the sciences but rarely applied himself.

If he had hopes for a career in academic research, they were dealt a serious blow by an unremarkable performance in his final exams. Instead, Strachey spent World War II working for a British electronics firm and became a schoolteacher afterward, eventually landing at Harrow, one of the most prestigious public schools in London.

In 1951 Strachey had his first chance to work with computers when he was introduced to Mike Woodger at Britain’s National Physical Laboratory. After spending a day of his Christmas vacation getting acquainted with the lab’s Pilot ACE, he spent his free time at Harrow figuring out how to teach the computer to play checkers. As Martin Campbell-Kelly, a colleague of Strachey in his later years, put it, “anyone with more experience or less confidence would have settled for a table of squares.”

This first effort didn’t come to fruition; the Pilot ACE simply didn’t have the storage capacity required to play checkers, but it did illustrate an aspect of Strachey’s interest that would prove instrumental in the development of the languages that led to C. At a time when computers were valued chiefly for their ability to quickly solve equations, Strachey was more interested in their ability to perform logical tasks (as he’d later confirm during the 1952 Association for Computing Machinery meeting).

Later that spring he found out about the Ferranti Mark I computer that had been installed at Manchester University, where Alan Turing was assistant director of the computer lab. Turing had written the programmer’s handbook, and Strachey knew him just well enough from their time together at Cambridge to ask him for a copy of the manual.

In July 1951, Strachey had a chance to visit Manchester and discuss his checkers program with Turing in person. Suitably impressed, Turing suggested that, as a first step, he write a program that would enable the Ferranti Mark I to simulate itself. A simulator would allow programmers to see, step by step, how the computer would execute a program. Such a ‘trace’ program would highlight places where the program caused bottlenecks or ran inefficiently. At a time when both computer memory and processor cycles cost a fortune, this was an important aspect of programming.

The trace program Strachey wrote included over a thousand instructions—at the time it was the longest program that had ever been written for the Ferranti Mark I. Strachey had it up and running after pulling an all-nighter, and when the program terminated, it played “God Save the King” on the computer’s speaker, according to Campbell-Kelly.

This accomplishment, by an amateur, caught the attention of Lord Halsbury, managing director of the National Research and Development Corporation, who soon recruited Strachey to spearhead the government’s efforts to promote practical applications of the rapid developments in computer science taking place at British universities.

It was in this capacity that he found out about a project at Cambridge being undertaken by a trio of programmers named David.

David and Goliath Titan

Cambridge University’s computing center had a strong service orientation. The Mathematical Laboratory’s first computers, EDSAC and EDSAC 2, were made available to researchers elsewhere at the university who wrote programs that were punched out on paper tape and fed into the machine.

At the computing center, these paper tapes were clipped to a clothesline and executed one after the other during business hours. This line of pending programs became known as the “job queue,” a term that remains in use to describe far more sophisticated means of organizing computing tasks.

At the 6:55 mark, enjoy some EDSAC “job queue” action.

Only two years after EDSAC 2 came online, the university realized that a far more powerful machine would be required soon, and in order to achieve this, they would need to purchase a commercial mainframe. The university considered both the IBM 7090 and the Ferranti Atlas, but it could afford neither of them. In 1961, Peter Hall, a division manager at Ferranti, suggested that they could develop a stripped-down version of the Atlas computer jointly with Cambridge University. Cambridge would get the prototype, dubbed “Titan,” and Ferranti would be able to market the new computer to customers who couldn’t afford the Atlas system.

In order to provide computing services to the rest of the university, this new computer would need both an operating system and at least one high-level programming language.

There was little thought given to expanding the language that had been developed for EDSAC 2. “In the early 1960s, it was common to think, ‘We are building a new computer, so we need a new programming language,’” David Hartley recalled in a 2017 podcast. Along with David Wheeler and David Barron, Hartley would be involved in the early development of this new computer’s programming language.

“The new operating system was inevitable,” according to Hartley, but a new programming language was not. “We thought this was an opportunity to have fun with a new language—which, in hindsight, was a damn stupid thing to do.”

Maurice Wilkes, who was overseeing the Titan project, felt that there was no need for a new programming language. The primary justification for the Titan was providing computational services to the rest of Cambridge University, and for this it would be best if the machine were up and running as quickly as possible and equipped with a language users were already familiar with.

Wilkes required an analysis of available programming languages before approving a proposal to develop a new language. “We chose them very carefully,” Hartley said, “in order to decide that none of them were suitable.” Notably, the working group evaluated Fortran IV without consulting Fortran users at Cambridge who could have explained the additional features included with other varieties of Fortran. Because of this, Hartley recalled the group being convinced that “we could easily define and develop something significantly better,” before noting, “this failing came home to roost in a few years.”

The trio eventually prepared a paper in June 1962 that argued that a new language was necessary, “and we got away with it, too,” Hartley concluded.

This new programming language was dubbed CPL (Cambridge Programming Language), and work was well underway by 1963. The Cambridge programmers had been joined by John Buxton and Eric Nixon, from the University of London, and CPL had been revised to stand for Combined Programming Language. As the project grew, Wilkes decided to bring on Christopher Strachey to oversee the project, and CPL soon came to mean “Christopher’s Programming Language” for those associated with it, according to Campbell-Kelly.

The group of researchers working on the language would meet at Cambridge or in London, sometimes at the University of London, but on other occasions in the artist’s studio at the Kensington townhouse Strachey shared with his sister. The room at the rear of the home was furnished with Victorian chairs and cushions on the floor, while the walls were decorated with portraits of various Bloomsbury Group members painted by one of Strachey’s relatives. This was where Strachey would “hold court,” occasionally in a dressing gown, and as David Barron recalled some years later, “we would argue the world to rights before dispersing to our various homes in the evening.”

By then, David Wheeler had moved on to other projects, leaving a team of five behind: Hartley, Barron, Buxton, Nixon, and Strachey.

Hartley enjoyed working on CPL; “this was actually quite a fun job,” he recalled. Meetings were rather informal affairs. “We’d get very heated about things and eventually start throwing paper darts [airplanes] at one another.”

The group started off with the specifications of ALGOL 60, with the goal of writing a “perfect” language: one that would be practical for a variety of users but also aesthetically satisfying and efficient.

Almost immediately, they had some difficulty prioritizing, as David Barron noted of Strachey, “It was characteristic of him to insist on minor points of difference with the same force that he insisted on major points.” One minor quibble was Strachey’s objection to the grammar of “IF … THEN … ELSE” statements. “I cannot allow my name to be associated with a definite recommendation to use ignorantly incorrect English,” was his view, as Hartley later wrote for Annals of the History of Computing. Strachey preferred “OR,” which conflicted with the way “OR” was used in nearly every other programming language in existence. Nonetheless, his preferences carried the day, and the CPL reference manual included “OR” in the place where users would have expected “ELSE.”

The CPL Manual, <a href="http://www.ancientgeek.org.uk/CPL/CPL_Elementary_Programming_Manual.pdf">available online</a> of course.” src=”https://cdn.arstechnica.net/wp-content/uploads/2020/12/Ars_HistoryOfC.png” width=”624″ height=”509″><figcaption class=
The CPL Manual, available online of course.

Valuable time was also invested in developing a way to avoid using the asterisk to indicate multiplication. Here, aesthetic concerns led to complications that delayed the implementation of a usable programming language, as complicated rules had to be developed to distinguish between “3a” meaning “3 * a” and “3a” as the name of a variable.

All the while, Cambridge users were growing increasingly frustrated with the lack of a usable programming language for the university’s new Atlas computer. The specifications of the language were largely finished, but there was no compiler available. The working group had made CPL so complicated that early attempts at writing a compiler resulted in machine code that was incredibly inefficient.

Source