C – A Brief History

C is quirky, flawed and an enormously success – Dennis Ritchie

The story of the success of C is often told and retold. C is deemed as the mother of all modern programming languages since almost all surviving modern programming language finds it origin or resemblance with this language. However there are two points that must be interesting to note about this very high profile mother of modern programming languages –First, the story of C begins, interestingly, with a failure.

Flashback to 1969: Three giants – General Electric, MIT, and Bell Laboratories entered a joint venture to build an operating system – Multics(Multiplexed Information and Computing Service). Multics which will be remembered as a treasure house of solved software engineering problems. However, this software marvel was nearly doomed. First was failing to deliver anything usable at all. Even when it got into action (eventually) it was a painful experience and a painful realization. A realization that this OS is too big for the hardware it is meant for. And it also provided the world of programming with yet another philosophy –"small is beautiful".

 

 

 

So where does C fit in? Well project Multics episode is over; the story isn’t. As the disenchanted Bell Labs staff withdrew from the Multics project, they looked around for other tasks. One researcher, Ken Thompson, was keen to work on another operating system, and made several proposals to Bell management – predictably all declined. While waiting on official approval, Thompson and co-worker Dennis Ritchie amused themselves porting Thompson’s "Space Travel" software to a little-used PDP-7. At the same time, Thompson worked intensively on providing the PDP7 with the rudiments of a new operating system, much simpler and lighter-weight than Multics. It was suitably named Unics (Uniplexed Information and Computing Service), emphasising the lessons now learned from Multics on what not to do. Destiny, however, had another name for this OS – Unix.

While still waiting for official Bells Lab approval, Ken Thompson with his programmers’ band was busy in improving upon Unix. The earlier version of Unix kernel, shell, text editors and a handful of utilities (like rm, cp) were written using Thompsons assembler. It was a simplicity in itself – it evaluated expressions and emitted the corresponding bits. There were no libraries, 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.

Later the team decided that they needed a system programming language for their (yet to be named) OS. That is when Ken Thompson created his own programming language B. The language was adapted from yet another existing language BCPL (which in-turn had its origin in CPL and Algol60). B
can be considered as BCPL squeezed in 8K memory. B
was a type-less language. Thompson for sometime continued to bootstrap B (writing B using B itself) and continued to struggle against the 8K memory restrictions of the language. It yielded interesting short-hands such as x=+y (to add y to current value of x) and ++x to increment x by 1. He also devised virtual B memory system to use virtual memory and thus extend 8 K limitations.

With all the efforts, B was hardly more than an experimental stuff. Ken Thompson never wrote a true compiler for it that would convert source code to machine code; rather it worked on somewhat interpretive system called Threaded code. So performance remained a bottleneck. Floating point number representation, pointers representation and above all being type less were hindering the way of B
in rewriting Unix.

Occasionally, alternative main stream programming languages were given a thought, but the likes of Fortran/PL-1/Algol were hopelessly large for the available resource and need of the hour was something really small and compact.

 It was at this point of time, in 1971, that Dennis Ritchie took over the programming project and started improving on the design of B. He started by making language typed types, designed a compiler to output true machine code to compete with the assembly code. The new language for sometime was called NB (New B). However it quickly added on so many features that Ritchie felt it deserved a new name. Interested in giving it a single letter name it is later renamed to Cnext to B.

Transition from B to C was essentially contemporaneous with the creation of a compiler capable of producing programs fast and small enough to compete with assembly language. C took many of its basic elements from B. It even started with x=+y syntax which was changed to x+=y only in 1976.

 

I feel duty bound to complete the story of Unix which gave us the language. After initial promises that the unofficial OS showed the Bell Lab patronized the OS and provided it with better DEC-11 machines and other funds. In 1973, Unix was almost re-written in C. And barring a small portion of the code which still is assembly coded almost entire OS is in C. This broke the age old myth that something as complex as an operating system, which must deal with time-critical events, had to be written exclusively in assembly language. With the huge success of Unix, C too basked in its glory. And today C is synonymous to system programming and number one choice for writing Operating system.
 The fascinating history of C would never be complete without discussing a third name – Brain W. Kernighan. Brian’s name is somehow inseparable from Ken’s and Dennis’s. As much as those two contributed to the software itself, Brian added value by creating great tools and presenting the whole Unix concept to the world. In a way, Brian was the voice of the team. Brain was the person to coin the term Unics. And Brain Kernighan was the person who along with Ritchie presented to the world the very first specification for the language of C in the name of K & R C. Kernighan is also the co-author of the book – The  C Programming language. This book by the duo Kernighan and Ritchie is considered as the Bible of C.

 

In the beginning I mentioned that there are two points of interest to note about the language. What’s the second point? Did you notice? I already discussed it. That C was itself not a language from scratch. C, itself evolved and adapted a lot of language. So the Big question is why C should be considered as the mother of modern programming. Why not B? Because world never really tasted B. B was never designed to deliver what B can. And the biggest achievement of B is that it proved to be a foundation stone for C.

Before we move on to discuss the other aspects of Programming Let us summarize the motivations that led to the evaluation of C.

  • Project Multics failed because it was too heavy for the available resource.
  • C evolved with and for Unix following the philosophy of Small is Beautiful.
  • C was conceived with the motive to design an OS which so far were designed only using assembly like language. C needed to be as fast as Assembly code.
  • Many of the C language design are due to historic resource and memory constraints (8K)

C Language Standards

When C Language was first introduced to the world, there existed no standard specification. The C reference manual published as an appendix to the first edition of The C Programming language by Kernighan & Ritchie for the was adopted as the language specification and compiler vendors claimed to be fully compliant with K&R specification. However the specification was just about the language and not about the libraries. However, in context of C, against its predecessors, the library was one of the most important components and needed to be standard as dependence of C on its library was unprecedented. Thus to formalize a standard for C American National St

andard Institute (ANSI) established a committee (X3J11) in 1983 and its recommendations were adopted in 1989 as ANSI C which standardized both the language and its libraries. Later in 1990 ISO established ISO C which is essentially same as that of ANSI C. These two standardizations are often referred as C89 and C90. The highlights of the committee recommendations included:

  • Trust the programmer.
  • Don’t prevent the programmer from doing what needs to be done.
  • Keep the language small and simple.
  • Provide only one way to do an operation.
  • Make it fast, even if it is not guaranteed to be portable.

A joint ISO/ANSI committee (C9X) started reviewing C89/90 standard in 1994 and proposed C99 standard. The C9X committee endorsed the principles adopted in earlier standardization and laid down 3 basic pointers:

  • Support for Internationalization
  • Correction of deficiencies
  • Improvement in computational usefulness.

They further emphasized on keeping the language conceptually simple. In committee’s own word:

"…the committee is content to let C++ be the big and ambitious language"

One Reply to “C – A Brief History”

Leave a Reply

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