🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4440

Re: On sequence points and evaluation order

#4440
From: Christopher R. Volpe
Date: Thu, 07 Dec 1995 13:47
67 lines
3741 bytes
In article <TANMOY.95Dec5221739@qcd.lanl.gov>, tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes:
[snip]
|>   I agree with everything here and, I believe, in the rest of Chris's long
|>   article, *except* the implication that one of the two operands of the
|>   top-level + must be evaluated first.  I don't think Chris really meant to
|>   make that implication.  The evaluation sequence
|>
|>	   f()
|>	   left-hand i
|>	   right-hand i
|>	   right-hand +
|>	   top-level +
|>
|>   is one of the possibilities, and the left-hand operand of the top-level +
|>   is evaluated within the time that the right-hand operand is being done.

Agreed. What I meant was that it is unspecified whether the left hand i is
evaluated before or  after f() is called. 

|>
|>My question, which Chris was responding to, was whether the the i that
|>is the left operand of the top-level +, henceforth called the
|>top-level i, can be evaluated interleaved with the evaluation of f()
|>(Remember, f() contains a i=1). If it can, then there is a possible
|>sequence of evaluation where i is both modified (in f) and accessed
|>(top-level i) without intervening sequence points.

If that is the case, I'm switching back to Pascal. (0.1 :-)) I want to look at
a function definition and be able to say, "Ok, here's a semicolon, and there's
the next semicolon, and the only thing that's going to happen between these
two is what's *written* between these two" (as far as the abstract machine is
concerned, since obviously I don't give a hoot about what gets interleaved
where for optimization purposes, as long as the semantics are intact.)

|>
|>I do not have an opinion: how could I? As an ordinary user of the
|>language, all I can pray for is that the committee does not decide that
|>even this interleaving is prohibited by the panacea of `statements are
|>executed in sequence' :-( 

I agree that "statements are executed in sequence" has nothing to do with
this. 

|>
|>The issue of `f()+f()' is different: there one is talking of two
|>statements from two functions. Here we are talking about part of an
|>expression in the caller interleaving with evaluation of a statement
|>in f. In fact in `f()+f();', though the two operands of the + can be
|>interleaved, wasn't the informed opinion last time that _none_ of the
|>statements of one f can be evaluated before _any_ of the statements of
|>the other f, whatever effect that may have on optimization, though
|>which f is called first is indeterminate (Am I misremembering?). All

I hope that was the consensus.

|>this to satisfy the _unsatisfiable_ edict of `statements are evaluated
|>in sequence': after all `f()+f();' is a statement --- is it done
|>before or after the statements comprising f? 

It's not unsatisfiable, because the edict includes the phrase "except where
otherwise specified", and function calls are one of those exceptions.

--

Chris Volpe				Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D			Fax:   (518) 387-6560
PO Box 8, Schenectady, NY 12301		Email: volpecr@crd.ge.com
Technical Details
Message-ID: <4a6r9u$hq5@rdsunx.crd.ge.com>
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
References: <49l428$od0@bolverk.cs.cornell.edu> <49ojjp$hsm@newshost.lanl.gov> <49qiu7$25h@natasha.rmii.com> <49v3ii$nve@rdsunx.crd.ge.com> <1995Dec6.000503.6676@sq.com> <TANMOY.95Dec5221739@qcd.lanl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
From: volpe@bart.crd.ge.com (Christopher R. Volpe)
Newsgroups: comp.std.c
Subject: Re: On sequence points and evaluation order
Date: 7 Dec 1995 13:47:42 GMT
Organization: GE Corporate Research & Development
Sender: volpe@bart (Christopher R. Volpe)
Distribution: world
Message-ID: <4a6r9u$hq5@rdsunx.crd.ge.com>
References: <49l428$od0@bolverk.cs.cornell.edu> <49ojjp$hsm@newshost.lanl.gov>  <49qiu7$25h@natasha.rmii.com> <49v3ii$nve@rdsunx.crd.ge.com>  <1995Dec6.000503.6676@sq.com> <TANMOY.95Dec5221739@qcd.lanl.gov>
Reply-To: volpe@ausable.crd.ge.com
NNTP-Posting-Host: bart.crd.ge.com