Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!ucscc!tanj@ucbvax.berkeley.edu From: tanj@ucbvax.berkeley.edu Newsgroups: net.unix-wizards Subject: function parameters Message-ID: <1703@brl-smoke.ARPA> Date: Tue, 11-Mar-86 17:34:27 EST Article-I.D.: brl-smok.1703 Posted: Tue Mar 11 17:34:27 1986 Date-Received: Fri, 14-Mar-86 06:48:03 EST Sender: news@brl-smoke.ARPA Lines: 26 I just spent an hour trying to figure out why my working program suddenly stopped working. Here's the culprit: expand(*ptr++,*ptr++,*ptr++,ptr++,ptr++,ptr++); (I'm working on a graphics project, which involves mapping surface textures to the surface of a torus {bagel}. Expand takes a point and its norm and expands it to 16 more points by symmetry.) After careful searching of K&R I found the reason; The order of evaluation of arguments is undefined by the language; take note that the various compilers differ. [p. 186] The compiler I am using evaluates right to left. If I were to number the above arguments 1-6, when expand gets them they are 6-1. I find this contrary to my intuition. Can anyone out there give me a good reason as to why this is left up to compiler implementation? And if so is it generally true that evaluation of parameters is r-l? Sincerely, Michael Berman (tanj@ucscc.BITNET)