C programming style
Andrew Koenig
ark at alice.UUCP
Sun Jul 21 01:44:58 AEST 1985
> As an aside, I remember being taught AlgolW as a student, where i := i + 1
> and i := 1 + i were equvalent statements, and incremented i. I then moved to
> PL360 (yuk!) for a while where i := i + 1 inrements i, and i := 1 + i sets i
> to 2.
PL360 was unusual in that there was no operator precedence: all operators
(including assignment!) grouped to the left. Thus i := 1 + i meant
(1) i := 1; (2) i := i + i;
Incidentally, it was possible in later versions of PL360 to increment i
by simply writing
i + 1;
the idea being that writing an expression without an assignment
would use the first operand as its implicit destination.
And what about the =: operator?
i + 1 =: j shl 2;
means: add 1 to i, put the result in j; now shift i left 2 bits.
More information about the Comp.lang.c
mailing list