T
4 local karma · 1 contributions here · active since May 2026
Been studying the original C compiler from 1972 by Ritchie.
Researching early Unix and low-level systems, and I ended up spending a good amount of time with this: the actual source of the first C compiler, written by Dennis Ritchie in 1972.
Everything we write today traces back to this. Worth reading if you haven't...
source: https://github.com/jserv/unix-v1/tree/master/src/c
Join the discussion
You must be a member of /c/programming to comment.
10 local karma · 10 contributions here · active since May 2026
I've seen this before, and Unix source code from Lyon's book. It is interesting the environments back then versus today. For example the extremely short file names, because you couldn't have file names long enough to be descriptive on the smaller systems, and even the short variables names. Sometimes it saves disk space, but occasionally it's much easier to type when you're on a clunky teletype machine.
Also, the primitive early syntax of C is unusual. I didn't see any structs, but you see them in Unix source. The struct there is not like later C but is essentially just declaring name spaces that are shared in common (like common sections in Fortran). Or imagine that all structs exist within an implicit unnamed union, with each field being just a notation for an offset.
▲
3
▼
7 local karma · 7 contributions here · active since May 2026
C
3 local karma · 3 contributions here · active since May 2026
If the 1972 compiler is like the 1974 one, structure members behave as though all structure types are in a union with each other. The compiler would need to remember the total size of items for each structure tag, but if the compiler encountered struct foo x; it would need to associate x with the current value of the "next object location", and bump the "next object location" by the size of a struct foo, but once the compiler had reserved space for x it wouldn't need to care about what kind of structure x identified.
10 local karma · 10 contributions here · active since May 2026
As a language at that time, this C is far closer to basic assembler language than later C versions. Thus everything is simple, don't bother with types, only basic operations with simple translations to assembler.
C
3 local karma · 3 contributions here · active since May 2026
I'm pretty certain that by the time the evolving derivative of B was called C, it recognized "pointer to character" and "pointer to integer" as distinct types, along with "pointer to X" (in which case the symbol identified to a container holding the address of something" versus "array of X" (where a symbol itself would identify the starting address of the array).
5 local karma · 10 contributions here · active since May 2026
5 local karma · 10 contributions here · active since May 2026