🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2642

Re: Function Argument Evaluation

#2642
From: Christopher R Volpe
Date: Fri, 29 Mar 1991 13:23
32 lines
1595 bytes
In article <1991Mar28.194627.26285@mtxinu.COM>, ed@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@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@crd.ge.com
Technical Details
Message-ID: <18022@crdgw1.crd.ge.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!camelback!volpe
References: <3461@inews.intel.com> <1991Mar26.181821.22912@cs.ucla.edu> <17936@crdgw1.crd.ge.com> <15607@smoke.brl.mil> <17983@crdgw1.crd.ge.com> <1991Mar28.194627.26285@mtxinu.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!camelback!volpe
From: volpe@camelback.crd.ge.com (Christopher R Volpe)
Newsgroups: comp.std.c
Subject: Re: Function Argument Evaluation
Message-ID: <18022@crdgw1.crd.ge.com>
Date: 29 Mar 91 13:23:07 GMT
References: <3461@inews.intel.com> <1991Mar26.181821.22912@cs.ucla.edu> <17936@crdgw1.crd.ge.com> <15607@smoke.brl.mil> <17983@crdgw1.crd.ge.com> <1991Mar28.194627.26285@mtxinu.COM>
Sender: news@crdgw1.crd.ge.com
Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe)
Lines: 32