Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Message-ID | <4F58B8DC.4433@mindspring.com> (permalink) |
|---|---|
| Date | 2012-03-08 08:49 -0500 |
| From | pete <pfiland@mindspring.com> |
| Organization | PF |
| Newsgroups | comp.lang.c |
| Subject | Re: Evaluation Order in Function Declaration |
| References | <jihoad$2pj$1@dont-email.me> |
Shao Miller wrote:
>
> Is the evaluation order guaranteed to be left-to-right for the
> declaration of 'baz' in the following code? Or are the array size
> expressions unsequenced relative to one another, as in 'a + b'? Or
> something else?
>
> #include <stdio.h>
>
> int foo(void) { puts("foo"); return 1; }
> int bar(void) { puts("bar"); return 1; }
>
> int baz(int (* x)[foo()], int (* y)[bar()]) { return 0; }
>
> int main(void) { return baz(0, 0); }
Whether that program will output "foo" or "bar" first,
is unspecified.
n1570
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
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Evaluation Order in Function Declaration Shao Miller <sha0.miller@gmail.com> - 2012-02-28 00:22 -0500
Re: Evaluation Order in Function Declaration Jens Gustedt <jens.gustedt@loria.fr> - 2012-02-28 10:14 +0100
Re: Evaluation Order in Function Declaration Kaz Kylheku <kaz@kylheku.com> - 2012-02-28 09:31 +0000
Re: Evaluation Order in Function Declaration Jens Gustedt <jens.gustedt@loria.fr> - 2012-02-28 13:09 +0100
Re: Evaluation Order in Function Declaration pete <pfiland@mindspring.com> - 2012-03-08 08:49 -0500
csiph-web