MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

RE: Operators



On Mon, 22 Apr 1996, Roger Crew wrote:
> w.r.t. the various suggestions about adding +=, *=, ++ and other
> C/C++-isms to MOO, keep in mind that the only reason these are in C in
> the first place is because the PDP-11 didn't have much room for compiler
> smarts; thus you had programmers essentially writing register-twiddling
> code themselves.  You really only need += if your compiler isn't very
> good at common subexpression elimination.

I wasn't around then, but:

"Thompson conceived the ++ and -- operators and added them to the B
compiler on the PDP-7. The popular and captivating belief that they're in
C because the PDP-11 featured corresponding auto-increment/decrement
addressing modes is wrong! Auto-increment and decrement predate the PDP-11
hardware, though it is true that the C statement to copy a character in a
string: *p++ = *s++; can be compiled particularly efficiently into the
PDP-11 code: mov (r0)+, (r1)+ leaving some people to wrongly conclude that
the former was created especially for the latter."
--Peter van der Linden, _Expert C Programming: Deep C Secrets_, pp. 3-4


In any case, my two cents on this issue are:
1) I like the idea of having ++/-- because I frequently write statements
like count = count+1; and I'm lazy

2) I don't really see the point in adding it to MOO, though.  If you're
going to add something at this point, add something that can't already be
done.  Of course, if you're creating a new system from scratch, then maybe
this is something worth including.



anomaly@u.washington.edu



Follow-Ups: References:

Home | Subject Index | Thread Index