From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: printf bug ??? Date: Fri, 5 Jun 1998 21:21:39 +0100 Organization: None Message-ID: References: <35784F8A DOT AB5D79CC AT gpu DOT srv DOT ualberta DOT ca> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 23 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Blaine Hodge writes: >> > printf("%d %d %d", i, i++, i++); > >Yup. This is the correct response you should get. Arguements are >popped onto the stack right to left for function calls. [...] >Then its VC at fault (gee, imagine that), sounds like its evaluating it >using the Pascal calling method, left to right, and not C/C++, right to >left. Not true. I'm not 100% sure of the rules for argument evaluation, but I suspect that different compilers are allowed to do these in whatever order they prefer. I do know for a fact that the ANSI standard explcitly says that the results are undefined if you use a ++ operator in a statement that also modifies the variable in some other way. Eg. if you were to write something like "i += i++;", the compiler is entitled to do whatever the hell it likes with that statement, including nothing. The error lies in the code, not the compiler... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ "Miracles are nothing if you've got the wrong intentions" - Mike Keneally