Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!flaps From: flaps@utcsri.UUCP (Alan J Rosenthal) Newsgroups: comp.lang.c Subject: Re: order of evaluation Message-ID: <4328@utcsri.UUCP> Date: Sun, 8-Mar-87 02:11:06 EST Article-I.D.: utcsri.4328 Posted: Sun Mar 8 02:11:06 1987 Date-Received: Mon, 9-Mar-87 01:56:45 EST References: <616@viper.UUCP> Reply-To: flaps@utcsri.UUCP (Alan J Rosenthal) Organization: University of Toronto Lines: 29 Summary: In article <616@viper.UUCP> john@viper.UUCP (John Stanley) writes: >I still feel that the standard should have rules >which will allow a programmer to -know- the exact order of evaluation for >any equation. It does.. use temporaries. For example, if you want the sum a+b+c evaluated in the order implied by (a+b)+c, simply write two statements, the first of which is t=a+b; and the second of which contains the expression t+c. (If you have a REALLY good optimizer it's possible that this temporary variable will be optimized out completely. In any case, the redundant store/load will probably be optimized out.) >I know this is not likely for the sole reason that there >are too many different compilers already existing that do the ordering in >far too many different ways. Also for the reason that there is quite likely a different best order for different machines, so the compilers should be free to implement the best order for their machine. -- Alan J Rosenthal UUCP: {backbone}!seismo!mnetor!utgpu!flaps, ubc-vision!utai!utgpu!flaps, or utzoo!utgpu!flaps (among other possibilities) ARPA: flaps@csri.toronto.edu CSNET: flaps@toronto BITNET: flaps at utorgpu