Chapter 19. Ancient Compilers

Almost in every kingdom the most ancient families have been at first princes’ bastards....

Robert Burton

C has evolved over the years. In the beginning, it was something thrown together by a couple of hackers (Brian Kernigham and Dennis Ritchie) so that they could use a computer in the basement. Later the C compiler was refined and released as the “Portable C Compiler.” The major advantage of this compiler was that you could port it from machine to machine. All you had to do was write a device configuration. True, writing one was extremely difficult, but the task was a lot easier than writing a compiler from scratch.

The Portable C Compiler was widely distributed and soon became the most widely used C compiler around. Because there were no official standards around at the time, whatever the Portable C Compiler could compile became the “official” standard.

This chapter describes that “standard.” The Portable C Compiler didn’t have many of the features that were later defined in the ANSI standard. Many of these new features were added to make C programs safer and more reliable. Programming in ANSI C is difficult enough. Programing in the old Portable C is like walking a tightrope with no net—blindfolded.

K&R-Style Functions

K&R-style C compilers use an older style of declaring functions. For example, the ANSI C function declaration:

int process(int size, float data[], char *how)

in K&R C would be:

int process(size, data, how) int size; float data[ ]; char *how; ...

Get Practical C Programming, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.