Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ucbcad!ucbvax!sdcsvax!ucsdhub!jack!man!nu3b2!nusdhub!rwhite From: rwhite@nusdhub.UUCP (Robert C. White Jr.) Newsgroups: comp.lang.c Subject: Re: another auto-increment problem Message-ID: <110@nusdhub.UUCP> Date: Mon, 28-Sep-87 15:01:24 EDT Article-I.D.: nusdhub.110 Posted: Mon Sep 28 15:01:24 1987 Date-Received: Wed, 30-Sep-87 04:35:14 EDT References: <3680001@wdl1.UUCP> <6484@sgi.SGI.COM> Organization: National University, San Diego Lines: 24 Summary: Evaluation Order... A good reason. In article <6484@sgi.SGI.COM>, archer@elysium.SGI.COM (Archer Sully) writes: > > As for reasons why arguments to functions are evaluated right to left, > here's a pretty good one. It may be more efficient to evaluate each > argument just before it is pushed, rather than evaluating > the argument list and then pushing. Remember that most C-compilers > push arguments right to left rather than left to right, for various > and sundry reasons. If you find one that pushes arguments right > to left, it probably evaluates that way, too. There is a very good reason that the evaluation of arguments to a function are evaluated in a right to left fassion. [on some machines anyway, I don't know if it is a "universal" truth or not.] In any function which takes a variable number of arguments of possibly variant size, it is best to have the argument which defines the size and type of future arguments on the TOP of the stack. If it were pushed first, it would be under N words of stack where N is an undefined number between 0 and MAXSTACK-4(or more or less). This is not as uncommon as it seems all of the [sf]printf and [sf]scanf functions use the format string for just such a variant descriptor. Robert ("So who asked you anyway?") White.