Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 08 Mar 2012 07:49:17 -0600 Message-ID: <4F58B8DC.4433@mindspring.com> Date: Thu, 08 Mar 2012 08:49:16 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Evaluation Order in Function Declaration References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 31 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.219.165 X-Trace: sv3-Jj14uP3oqxoCKocsihOUp+hbrgpPoxD37ehthT7iOB65w58rLhDwQ3ymdsAx3nBfYVm5XmTQt7cYzqk!vmqjX/vky5lzALH+6kACCIBsVbihSX74VysTMMd5/NqX/VTVXd3J9U4k5wGoe3Et5VWIeU8kUZV7!4ODbUHTMQjA= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1879 Xref: csiph.com comp.lang.c:18326 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 > > 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