|
|
Harald van =?UTF-8?b?RMSzaw==?= wrote:
>
> On Fri, 28 Mar 2008 20:27:09 -0500, pete wrote:
> > Harald van =?UTF-8?b?RMSzaw==?= wrote:
>
> [ printf("%d %d\n", ++n, power(2,n)); ]
>
> >> If arguments are evaluated
> >> strictly from left to right (nothing wrong
> >> with that), here are the steps:
> >> - evaluate "%d %d\n"
> >> - evaluate ++n
> >> - evaluate 2
> >> - evaluate n
> >> * call power
> >> * call printf
> >
> > The call to printf starts before any of its arguments are evaluated.
>
> What matters is when the call to power starts, as that is the only
> possible sequence point between the evaluation of ++n and n. I don't
> believe it starts before its arguments are evaluated.
It doesn't. You're right and I'm wrong.
N869
6.5.2.2 Function calls
[#12] EXAMPLE In the function call
(*pf[f1()]) (f2(), f3() + f4())
the functions f1, f2, f3, and f4 may be called in any order.
All side effects have to be completed before the function
pointed to by pf[f1()] is called.
--
pete
|
|