In the last couple of days I’ve being reading a lot about software development. Today, to read something different, I re-read “The development of the C language” by Dennis Ritchie. One good fact found in this paper, that it is not widely known, is why C was developed.
Before C there was a language called B developed by Ken Thompson. B had only one type named cell (or word). A cell had the size of the word of the processor. One of the main reasons C was developed was to add types of variable size to allow easier memory utilization.
When B was ported to the PDP-11, which had a 16 bit word, the character handling mechanisms were awkward. This was because in order to process characters you had to unpack the characters from cells, process them, and the repack them (to save memory). Also pointers in B where not efficient due to language constraints. The B language defined a pointer as an index in a cell array.
This lead to the development of C. C added data types (of different size) to the variables. The data types introduced were char, int and their array and pointer types.
I believe that the above explains why the type system of the C language is not safe. It was not designed to be safe, it was designed to allow better memory utilization. Type checking was not very important back in 1971.
For more info see the great paper The Development of the C Language, Dennis M. Ritchie Bell Labs/Lucent Technologies