🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2691

Re: More Re: Function Argument Evaluation argument

#2691
From: Paul Eggert
Date: Sat, 06 Apr 1991 02:22
24 lines
1593 bytes
In commenting on

	printf("%d %d\n", (1, v), (1,v++));

volpe@camelback.crd.ge.com (Christopher R Volpe) writes:

	No matter what the order of evaluation of the function
	arguments is, there's always a sequence point separating the
	references to v.

While the ANSI standard does not clearly address this point, Jim Brodie
has reported [Journal of C Language Translation 2, 3 (Dec. 1990), 207-215]
that the general opinion of X3J11 seems to be that the sequence point
in an expression X=F(Y) prior to the call to F causes only a partial
ordering on the subexpressions F and Y; it does not control the
ordering of other subexpressions like X.  From this, I would expect
that the sequence point between A and B in the comma expression (A,B)
establishes only a partial order on A and B, and does not place
constraints on the ordering of expressions outside (A,B).  Therefore,

	printf("%d %d\n", (1, v), (1,v++));

isn't conforming, because an implementation can evaluate the two `1's
first, and then evaluate `v' and `v++' in parallel, so to speak.
Technical Details
Message-ID: <1991Apr6.022220.6449@twinsun.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggert
References: <17936@crdgw1.crd.ge.com> <15607@smoke.brl.mil> <RJOHNSON.91Apr1142143@olorin.shell.com> <18140@crdgw1.crd.ge.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggert
From: eggert@twinsun.com (Paul Eggert)
Newsgroups: comp.std.c
Subject: Re: More Re: Function Argument Evaluation argument
Message-ID: <1991Apr6.022220.6449@twinsun.com>
Date: 6 Apr 91 02:22:20 GMT
References: <17936@crdgw1.crd.ge.com> <15607@smoke.brl.mil> <RJOHNSON.91Apr1142143@olorin.shell.com> <18140@crdgw1.crd.ge.com>
Sender: usenet@twinsun.com
Organization: Twin Sun, Inc
Lines: 24
Nntp-Posting-Host: ata