Unix-jun72: Restoration of 1st Edition UNIX kernel sources
code.google.com
code.google.com
Interesting to see the implementation of something like printf though: http://code.google.com/p/unix-jun72/source/browse/trunk/src/...
EDIT: On further inspection, the code below the switch block is meant to behave like a "default" block. I bet this is before they invented "default".
Maybe 1972-era C pushed arguments to the stack according to the signature defined in the function definition rather than the function call? (i.e. printf would have 10 pushes no matter how many arguments you actually passed to it). If it pushed according to the function signature, you'd waste memory and have a hard limit to how many arguments you could pass. And you'd waste push instructions. So I don't know why it's written the way it is, but corrupting your locals doesn't seem like a likely explanation. Maybe they're trying to mollify the compiler?
(as I was going to add before getting noprocrast-blocked)
[1] http://linux.die.net/man/1/bcc
(Why do I have experience with strange, non-compliant 16 bit C compilers? Because I have an eccentric professor for my operating systems class, apparently.)
I see several curious things here:
- They use auto :)
- They don't declare type, since (I think) things are implicitly int.
- They prefer using adx[] instead of *adx, I think this goes with the auto.