Not only that, but...
H. Munster
dave at murphy.UUCP
Sat Nov 8 04:24:36 AEST 1986
In article <630 at dg_rtp.UUCP>, throopw at dg_rtp.UUCP (Wayne Throop) types:
>Again folks, play it safe: *NEVER* have two side-effects on a single
>object in a single expression.
Not only that, but: don't even *USE* an assigned-to object anywhere else
in the expression!
An example, given by K&R on p. 50:
a[i] = i++;
What is the value of i in the subscript? Who knows? Keep in mind this quote
from the same page: "When side effects (assignment to actual variables) takes
place is left to the discretion of the compiler, since the best order strongly
depends on machine architecture." I interpret this to mean that the assign-
ment doesn't have to be done *anywhere* within the statement...in fact, it
doesn't have to be done until just before the variable is referenced again!
---
It's been said by many a wise philosopher that when you die and your soul
goes to its final resting place, it has to make a connection in Atlanta.
Dave Cornutt, Gould Computer Systems, Ft. Lauderdale, FL
UUCP: ...{sun,pur-ee,brl-bmd}!gould!dcornutt
or ...!ucf-cs!novavax!houligan!dcornutt
ARPA: wait a minute, I've almost got it...
"The opinions expressed herein are not necessarily those of my employer,
not necessarily mine, and probably not necessary."
More information about the Comp.lang.c
mailing list