Ritchie
Portability
By early 1973, the essentials of modern C were complete. The language and compiler were
strong enough to permit us to rewrite the Unix kernel for the PDP11
in C during the summer of
that year. (Thompson had made a brief attempt to produce a system coded in an early version of
C
retargeted to other nearby machines, particularly the Honeywell 635 and IBM 360/370; because
the language could not live in isolation, the prototypes for the modern libraries were developed.
In particular, Lesk wrote a ‘portable I/O package’ [Lesk 72] that was later reworked to become
the C ‘standard I/O’ routines. In 1978 Brian Kernighan and I published
Language
this book served as the language reference until a formal standard was adopted more than
ten years later. Although we worked closely together on this book, there was a clear division of
labor: Kernighan wrote almost all the expository material, while I was responsible for the
appendix containing the reference manual and the chapter on interfacing with the Unix system.
During 19731980,
the language grew a bit: the type structure gained unsigned, long, union,
and enumeration types, and structures became nearly firstclass
objects (lacking only a notation
for literals). Equally important developments appeared in its environment and the accompanying
technology. Writing the Unix kernel in C had given us enough confidence in the language’s usefulness
and efficiency that we began to recode the system’s utilities and tools as well, and then to
move the most interesting among them to the other platforms. As described in [Johnson 78a], we
discovered that the hardest problems in propagating Unix tools lay not in the interaction of the C
language with new hardware, but in adapting to the existing software of other operating systems.
Thus Steve Johnson began to work on
machines [Johnson 78b], while he, Thompson, and I began to move the Unix system itself to the
Interdata 8/32 computer.
The language changes during this period, especially around 1977, were largely focused on
considerations of portability and type safety, in an effort to cope with the problems we foresaw
and observed in moving a considerable body of code to the new Interdata platform. C at that time
still manifested strong signs of its typeless origins. Pointers, for example, were barely distinguished
from integral memory indices in early language manuals or extant code; the similarity of
the arithmetic properties of character pointers and unsigned integers made it hard to resist the
temptation to identify them. The
available without confusing it with pointer manipulation. Similarly, the early language condoned
assignments between integers and pointers, but this practice began to be discouraged; a notation
for type conversions (called ‘casts’ from the example of Algol 68) was invented to specify type
conversions more explicitly. Beguiled by the example of PL/I, early C did not tie structure pointers
firmly to the structures they pointed to, and permitted programmers to write
before structures in 1972, but gave up the effort.) Also during this period, the compiler wasThe C Programming[Kernighan 78]. Although it did not describe some additions that soon became common,pcc, a C compiler intended to be easy to retarget to newunsigned types were added to make unsigned arithmeticpointer>
member
taken uncritically as a reference to a region of memory designated by the pointer, while the member
name specified only an offset and a type.
Although the first edition of K&R described most of the rules that brought C’s type structure
to its present form, many programs written in the older, more relaxed style persisted, and so
did compilers that tolerated it. To encourage people to pay more attention to the official language
rules, to detect legal but suspicious constructions, and to help find interface mismatches undetectable
with simple mechanisms for separate compilation, Steve Johnson adapted his
to produce
almost without regard to the type of pointer; such an expression waspcc compilerlint [Johnson 79b], which scanned a set of files and remarked on dubious constructions.Growth in Usage
The success of our portability experiment on the Interdata 8/32 soon led to another by Tom
London and John Reiser on the DEC VAX 11/780. This machine became much more popular
than the Interdata, and Unix and the C language began to spread rapidly, both within AT&T and
outside. Although by the middle 1970s Unix was in use by a variety of projects within the Bell
No comments:
Post a Comment
THE WORLD NEW TECHNOLOGY