PS I synthesize here in my own words what K&R teach, re-write all their example programs, character by character, solve all the C exercises they hand out. I comment to what K&R teach cursively. I do not copy-paste anything from the book!
TCPL 2Ed - Page 001 to 002 - 2.26% Completion
TCPL 2Ed - Page 001 to 002 - 2.26% Completion
The preprocessing step in C performs:
- macro substitution on program text
- inclusion of other source files (since a C program can be spread over any number of separate, connected, source files)
- conditional compilation.
C is quite low level. The authors mean by this that C interacts with the objects a computer interacts with:
- characters
- numbers
- addresses
Which are combined and moved around with the arithmetic and logical operators, in the way computer hardware uses them.
C does not deal with composite objects (character strings, sets, list or arrays) directly. No operations are available that manipulate an entire array or string, although structures can be copied as a unit.
C does not offer:
- C does not provide storage allocation facility. apart from:
> the stack definition
> the stack discipline provided by the local variables of functions
- there is no heap or garbage collection in C.
- C itself does not provide input/output
- there are no READ or WRITE statements
C does not have built-in file access methods
These, more high-level features are provided by explicitly called functions.
C's control flow is:
- straightforward
- single thread
> loops
> grouping
> subprograms
C's control flow does not have:
- multi programming
- parallel operations
- synchronization
- co-routines
It may seem as if C is deficient without some of these features, but keeping the language small has benefits in it's own right. Because of it's small size can relatively easily be described and learned. When learning C it is to be expected that the programmer can know and understand and use the language in its entirety.
The writers go on about the C standard:
In the beginning the reference manual included in the 1st ed of K&R's book The C Programming Language was used as the standard. From 1989 onward the ANSI C89 took on this role, although, by then, this standard was already followed, since the standard was a standardization of general common practice as it already existed among C programmers.
(However the new official standardization was needed, since, apart from that common practice there were also many practices that were not commonly shared, and this created issues among programmers, platforms and compilers.)
The standard was not intended to innovate the language, but rather to preserve it. To sustain backward compatibility with programs that were created in the past. To curtail all kinds of innovations individual programmers had been making.
Hence only very few editions were made and the C89 standard remains almost the same as the reference manual of the 1st Ed.
The most important changes:
- new syntax for declaring and defining functions.
A declaration of a function can now contain descriptio of the arguments of the function. This helps compilers to detect mismatched arguments.
- structure assignments and enumerations
These were already in use unofficially, and are now officially part of C
- floating-point compilations can now be done in single precision
- the properties of arithmetic are now clarified (especially for unsigned types)
- the processor is more elaborate
These changes have minor effect on most programmers.