Pure and applied C
utzoo!decvax!harpo!npoiv!alice!research!dmr
utzoo!decvax!harpo!npoiv!alice!research!dmr
Mon Dec 27 01:36:35 AEST 1982
John Levine wondered whether, in the call bar(x++) with x global,
bar would see the old or the incremented value of x. The parameter
is clearly the old value; the question is whether the compiler might
be allowed to do the increment after the call.
Pure C gives little reassurance either way. "Otherwise, the order of
evaluation of expressions is undefined. In particular the compiler considers
itself free to compute subexpressions in the order it believes most
efficient, even if the subexpressions involve side effects."
Applied C is a little more cautious. Steve Johnson brought up this very
point when he was writing PCC, and I said that as far as I knew he was
entitled to delay the increment. We agreed, though, that the result
might surprise people, and he decided not to rock the boat.
Dennis Ritchie
More information about the Comp.lang.c
mailing list