TCPL 2Ed - Page ix to x - 0.75% Completion
The C Programming Language 2ed (ANSI C) by (Brian W) Kernighan & (Dennis) Ritchie (1988)
(I have been studying in this book while I was changing my OS. I was using a cheap, very slow, internet pack so I could not work online for many hours. Luckily I have this physical book. It is also the most famous book of all, written by the original founders of the language for the first time in 1978 (1st edition).
Preface
The book starts with referring to the 1st edition, which was the first book on C that was available to the public. It was, just like this 2nd Ed, also written by Kernighan and Ritchie, who were pioneers not only of C programming but also, even more importantly, of the operating system called Unix, for which C was developed as a tool to create this OS, and the programs running on it.
The authors describe how, since the first edition, devices became more powerfull, and C was being ported to many other platforms, besides Unix. Countless people experimented with, added to the language and created compilers for it independently from the creators, causing inconsistencies and outright incompatibilities between compilers. Hence the need arose to standardize the language. In 1983 this endeavor was commenced by the American National Standards Institute (ANSI), who created a dedicated committee to further the aim. From this came the expression "ANSI C". The correct label, however is ANSI's C89 or ISO C90, which was provided by another standardization institute, but which is essentially the exact same standard.
This new standard adds the following features to the original expression in the 1st Ed:
- it further clarifies a few aspects that were only hinted at in the first edition, like for example, structure assignment and enumerations
- it provides a new form of function declaration that allows cross-checking of definition with use
- it specifies a standard library with an extensive set of functions for input and output, memory management, string manipulation, etc.
- it explains new features that were not presented in the first book
- it makes explicit which aspects are machine-dependent (and thus not universal)
All these aspects were already in use before the standard, but are now articulated and standardized. A program can only be called ANSI C if it remains within the bounds of the standard. In this way programmers know what kind of a program they are dealing with if they receive it, and if they want to use an ANSI compliant compiler they will know what programming will be accepted by this compiler and what will be seen as erroneous.
The authors state that they have re-written the book from the standpoint of the new standard, while mentioning which aspects used to be different (instead of the other way around), although this does not make a real difference. They add that the practice on the ground already resembled the new standard largely and current compilers are already largely consistent with it. They say that the most visible change is the new function declaration and definition.
Apart from the exact content the authors have retained the overall compact feel of the first book. They say, because C is a small language, it isn't fitting a big book.
A few improvements they say they added:
- the exposition of pointers as central to C
- refinement of original examples
- addition of new examples, for example in the instance of complicated declarations, programs are used to convert declarations into words and words into declarations
- as in the 1st edition was the case too, examples have been tested directly from the text, which is in machine-readable form
Appendix A is a reference manual, but is not meant a representation of the standard. nor as a definition for compiler writers. It is meant for helping programmers to comprehend the language.
Appendix B is an overview of the facilities of the standard library. Again as a reference for programmers who want to use C, not implementers of compilers.
Appendix C lists all the changes from the 1st Ed to the 2nd Ed.