3 ms·
The reason C didn't expose registers is because it was specifically made to run on a PDP-7 and PDP-11. That's the sole reason for many of its internal decisions
by nickpsecurity 10y ago
The reason C didn't expose registers is because it was specifically made to run on a PDP-7 and PDP-11. That's the sole reason for many of its internal decisions. Doing things differently than a PDP-7 or PDP-11 would've hurt performance. So, they kept it consistent whenever performance or complexity was critical.
Decisions like that and x86 is why stack operations are still dangerous despite B5000 (1961) having protected stack and MULTICS (UNIX/C predecessor) having reverse stack immune to overflow. C kept the shitty PDP stack instead of MULTICS for performance. Reverse stack on x86 still has performance hit due to that decision. It's why Itanium did shadow stack in hardware.
Not clever design or forward thinking. Just making it work on a PDP with long-term problems following.
- GFK_of_xmaspast 10y ago> The reason C didn't expose registers Uh ... http://ee.hawaii.edu/~tep/EE160/Book/chap14/subsection2.1.1.2.html http://ee.hawaii.edu/~tep/EE160/Book/chap14/subsection2.1.1....
- nickpsecurity 10y agoYeah, I've used the keyword myself but it was discouraged. Instead, we were taught to work with the local variables, stack, frame, heap, etc. It's technically in there at some point as a compiler hint but the internal structure reflects the PDP's. So, I partly take the comment back in that it was there but not standard practice.