More Re: Function Argument Evaluation argument

Christopher R Volpe volpe at camelback.crd.ge.com
Tue Apr 2 23:24:16 AEST 1991


In article <RJOHNSON.91Apr1142143 at olorin.shell.com>, rjohnson at shell.com
(Roy Johnson) writes:
|>I understand that the comma operator is a sequence point.
|>If we use the comma operator as a sequence point between evaluations:
|>
|>   int v=1;
|>   printf("%d %d\n", (1, v), (1,v++));
|>
|>This can print
|>	1 1
|>or
|>	2 1
|>
|>Do I win?  8^)

Hey, that looks pretty good. No matter what the order of evaluation of
the function arguments is, there's always a sequence point separating the
references to v. So the behavior is not undefined, yet order of evaluation
definitely has a drastic effect on the output. 

Anybody see a problem with that?
                              
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.std.c mailing list