🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1453

Re: sequence points

#1453
From: diamond
Date: Fri, 29 Jun 1990 01:30
35 lines
2209 bytes
In article <1988@mcrware.UUCP> jejones@mcrware.UUCP (James Jones) writes:
>>Suppose one has an expression of the form
>>	func1(<argument list>) + func2(<argument list>)
>>Can a standard-conforming implementation evaluate *both* argument lists before
>>calling either function?

In article <103459@convex.convex.com> grogers@convex.com (Geoffrey Rogers) writes:
>The dp ANSI, Dec 89, page 42, states "The order of evaluation of the function
>designator, the arguments, and subexpressions within the arguments are 
>unspecified, but there is a sequence point before the actual call".

This is 100% true.

But there are lots of other places where sequence points can occur too.
Suppose an argument contains an imbedded comma operator.  That means that
certain other operations must have been completed before this sequence
point.  What kinds of other operations must have been completed?  Other
function calls?

Is there a sequence point after the return from the actual call?  I would
guess not, by default, since the standard does not say.  Would the committee
have put one there if they had thought of this problem?  Maybe the
interpretation committee will decide that that it is just an editorial matter
and tell us that the standard does say something about it?

>This would lead me to believe that you can evaluate all of the arguments for
>both functions before calling either one.

I agree with this conclusion too, but feel uncomfortable with it.

>Most compilers I seen do evaluation a function at a time.
(Except of course for common subexpression elimination.)
-- 
Norman Diamond, Nihon DEC     diamond@tkou02.enet.dec.com
This is me speaking.  If you want to hear the company speak, you need DECtalk.
Technical Details
Message-ID: <1822@tkou02.enet.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!diamond
References: <1988@mcrware.UUCP> <103459@convex.convex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!diamond
From: diamond@tkou02.enet.dec.com (diamond@tkovoa)
Newsgroups: comp.std.c
Subject: Re: sequence points
Message-ID: <1822@tkou02.enet.dec.com>
Date: 29 Jun 90 01:30:46 GMT
References: <1988@mcrware.UUCP> <103459@convex.convex.com>
Reply-To: diamond@tkou02.enet.dec.com (diamond@tkovoa)
Organization: Digital Equipment Corporation Japan , Tokyo
Lines: 35