Path: utzoo!mnetor!uunet!husc6!rutgers!bellcore!faline!ulysses!allegra!alice!dmr
From: dmr@alice.UUCP
Newsgroups: comp.arch
Subject: Re: C machine
Message-ID: <7535@alice.UUCP>
Date: 14 Dec 87 07:34:38 GMT
Organization: AT&T Bell Laboratories, Murray Hill NJ
Lines: 39

djsalomon@watdragon.waterloo.edu, in common with lots of others,
thinks that C was designed to be optimal on the PDP-11, in particular
because of the ++ and -- operators.  Actually, this is much less
so than usually believed.

In particular, ++ and -- were inherited from B, which was invented
before the PDP-11 existed.  Now, the PDP-7 on which B was designed had a
primitive form of autoincrement cell, as did other machines of its era
and before, and this, no doubt, suggested the operators.  However, the
PDP-7 autoincrement was of no use in implementing them; B was
interpreted, not compiled, on that machine.  (Incidentally, what
the PDP-7 provided was the operation

    *(int *)X++

where X was an absolute address between 8 and 15, I believe.)

There is in fact rather little that is PDP-11 specific in C.
Aside from things that are nearly universal these days, it prefers

	1) byte addressed memory
	2) ability to do simple arithmetic on pointers
	3) recursive calls (i.e. ability to run a stack)
	4) ability to use variadic functions

and these, though not universal, are common.  Point 4 can be an annoyance
on pure stack machines where the caller and callee are strongly encouraged
to agree statically on the number of arguments.

One thing in current (pre-ANSI) C that was clearly influenced
by peculiarities of the PDP-11 was in the rules for the float->double
conversions; even here, I found independent justification, perhaps
not conclusive, for writing the rules as I did.

Another was the notion of signed characters.  Other than these, I can't
think of much.


	Dennis Ritchie