Order of evaluation of nested function arguments

Frank Adams franka at mmintl.UUCP
Thu Feb 4 00:53:07 AEST 1988


In article <3995 at hoptoad.uucp> gnu at hoptoad.uucp (John Gilmore) writes:
>	return(A(--x,A(x,--y)));
>
>In the oct 86 draft standard, it says that (3.3) "the evaluation of the
>operands of an operator that involves a sequence point shall not be
>interleaved with other evaluations".  The function call operator
>clearly involves a sequence point (3.3.2.2) "The order of evaluation of
>the function designator, the arguments, and subexpressions within the
>arguments is unspecified, but there is a sequence point before the
>actual call".

I interpret this to mean that, from the point where the code starts
evaluating A(x,--y), until the actual call, nothing else can be executed.
But it does not mean that A(x,--y) must be evaluated before the --x is.  On
such an interpretation, there would be no legal evaluation order at all for,
e.g., A(A(--x,y),A(x,--y)).

The call A(x,--y) is not being "interleaved" with the evaluation of the
outer A and --x, because it is *part of* that evaluation.
-- 

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108



More information about the Comp.lang.c mailing list