Function Argument Evaluation

Christopher R Volpe volpe at camelback.crd.ge.com
Fri Mar 29 23:23:07 AEST 1991


In article <1991Mar28.194627.26285 at mtxinu.COM>, ed at mtxinu.COM (Ed Gould)
writes:
|>>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.
|>
|>Will this do?
|>
|>	foo() {
|>		int v = 1;
|>
|>		printf("%d %d\n", v, ++v);
|>	}

No, because before the sequence point that occurs before the call,
you are modifying v and using v in a way that is not used to determine
the new value of v. See my response to Blair's similar example.
(Either shortly before or after this post, depending on how things
get randomly rearranged over the net.)

|>
|>-- 
|>Ed Gould                    mt Xinu, 2560 Ninth St., Berkeley, CA  94710  USA
|>ed at mtxinu.COM		    +1 415 644 0146
|>
|>"I'll fight them as a woman, not a lady.  I'll fight them as an engineer."
                            
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.std.c mailing list