sequence points
diamond@tkovoa
diamond at tkou02.enet.dec.com
Fri Jun 29 11:30:46 AEST 1990
In article <1988 at mcrware.UUCP> jejones at 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 at convex.convex.com> grogers at 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 at tkou02.enet.dec.com
This is me speaking. If you want to hear the company speak, you need DECtalk.
More information about the Comp.std.c
mailing list