3 ms·
I was experienced with PDP-11 assembler when I was given a copy of K+R. Since many of C's semantics are based on the peculiarities of the -11 instructions, I un
by WalterBright 4y ago
I was experienced with PDP-11 assembler when I was given a copy of K+R. Since many of C's semantics are based on the peculiarities of the -11 instructions, I understood it immediately. It was a breath of fresh air compared to Fortran or Pascal. I never wrote another line in either of those languages after reading K+R.
Some things that come from the -11:
1. post increment and decrement
2. integer promotion rules
3. floating point promotion rules
3. `register` storage class
- 10000truths 4y ago4. Null-terminated strings, the scourge of all C programmers to come.
- davidgay 4y agoThe common alternative was single-byte-length strings. Null-terminated strings was much nicer.
- shadowofneptune 4y agoDennis Richie reports that the increment operators actually came from B on the PDP-7. It didn't have auto-increment addressing modes, but it did have memory locations which increment when read. "This feature probably suggested such operators to Thompson; the generalization to make them both prefix and postfix was his own. Indeed, the auto-increment cells were not used directly in implementation of the operators, and a stronger motivation for the innovation was probably his observation that the translation of ++x was smaller than that of x=x+1." https://www.bell-labs.com/usr/dmr/www/chist.html https://www.bell-labs.com/usr/dmr/www/chist.html
- ncmncm 4y agoRight, there was no room in memory for the compiler to implement peephole optimization. Or any other.