From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: Is this the normal behavior? Followup-To: comp.lang.c Date: Sat, 21 Jun 1997 16:16:07 -0700 Organization: Alcyone Systems Lines: 33 Message-ID: <33AC60B7.132063A0@alcyone.com> References: <33ABA2A0 DOT 539A AT sysnetway DOT com DOT br> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Edevaldo wrote: > It is more a C question than a DJGPP related one, but ... > When I execute this program: This should have been posted to comp.lang.c. Followups directed there. > #include > > int main( void) > { > int i; > > for( i=0; i<4; printf( "%i %i\n", i, i++) ); > > return 0; > }; ... > Is this the normal behavior? > In C the later arguments are evaluated first? The stack? This is ANSI standard C. In evaluating expressions, including function call arguments, you have no assurance of which order they will be evaluated in. Thus using subexpressions that have side effects on other subexpressions in the same expression, you will have undefined behavior. -- Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com Alcyone Systems / web / http://www.alcyone.com/max/ San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W \ "Covenants without the sword / are but words." / Camden