Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!lll-lcc!styx!ames!ll-xn!mit-eddie!husc6!uwvax!mcvoy From: mcvoy@uwvax.UUCP Newsgroups: comp.unix.questions Subject: Re: Evaluating autoincrements in function calls Message-ID: <3279@rsch.WISC.EDU> Date: Thu, 26-Feb-87 14:02:49 EST Article-I.D.: rsch.3279 Posted: Thu Feb 26 14:02:49 1987 Date-Received: Sat, 28-Feb-87 03:28:26 EST References: <4707@brl-adm.ARPA> Reply-To: mcvoy@rsch.WISC.EDU (Lawrence W. McVoy) Organization: U of Wisconsin CS Dept Lines: 20 In article <4707@brl-adm.ARPA> welch%UMASS.BITNET@wiscvm.wisc.EDU writes: ->In the second case the compiler is evaluating the arguments to ->the printf function right to left, including the autoincrement ->instructions, as it builds the stack. -> ->I don't want to be swamped with replies as to which set of results ->is correct but I would be interested to know if there is a standard ->which documents the correct behavior of argument evaluation. This is explicitly undefined in the K&R definition, in other words, you may not depend on any order of evalualtion when considering function parameters. My guess is that it was done as a efficiency/favour for/to compilers/{compiler writers}. Functions are done a lot; it would be ill-advised to slow them down by enforcing evaluation orders here. It is unfortunate, though. Inconsistencies suck. -- Larry McVoy mcvoy@rsch.wisc.edu, {seismo, topaz, harvard, ihnp4, etc}!uwvax!mcvoy "They're coming soon! Quad-stated guru-gates!"