Function Argument Evaluation

Christopher R Volpe volpe at camelback.crd.ge.com
Fri Mar 29 00:36:31 AEST 1991


In article <15607 at smoke.brl.mil>, gwyn at smoke.brl.mil (Doug Gwyn) writes:
|>In article <17936 at crdgw1.crd.ge.com> volpe at camelback.crd.ge.com
(Christopher R Volpe) writes:
|>>The only reason the output of the program in question can be
|>>"200 200" is because the BEHAVIOR of the PROGRAM (right Doug?) is
|>>undefined because the program violates the "shall" rule in paragraph
|>>2 of 3.3, ...
|>
|>NO -- my original argument did NOT rely on undefined behavior.  It
|>relied on the unspecified order of evaluation of the subexpressions.
|>Even without the cited "shall" in the standard, "200 200" would have
|>been a valid output (but not "42 3.1416").

But the only reason you were able to produce an order of evaluation that
resulted in "200 200" is because the program did something it should never
have done in the first place, which was to modify p twice between sequence
points. I would be very interested in seeing a program whose behavior
was *not* undefined, yet could arbitrarily produce either of two
drastically different outputs depending solely on the unspecified
order of evaluation. (By "drastically different" I mean something
like "100 200" vs. "200 200". I don't mean something like "12.427" 
vs. "12.426999".)          
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.std.c mailing list