post-decrement quirk?
Dale Worley
worley at compass.com
Wed Jun 19 00:03:43 AEST 1991
In article <1991Jun17.230838.9628 at auto-trol.com> julbro at auto-trol.com (Julie Brown) writes:
Can anyone explain to me why the following does not work
(at least on the Sun):
q = q--;
pre-increment works just fine (q = --q;).
According to Ansi C, neither of these is valid, because they both
modify q twice between two sequence points (during a statement). The
fact that the second happens to do what you want it to is luck.
BTW, what *is* it that you want to do? "q--" is equivalent to "q = q-1"
already, so you don't have to assign the result to q...
Dale Worley Compass, Inc. worley at compass.com
--
Start the project after the deadline -- the time pressure is less then.
More information about the Comp.lang.c
mailing list