Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!orchid!clyde!rutgers!mit-eddie!uw-beaver!ubc-vision!ubc-cs!manis From: manis@ubc-cs.UUCP Newsgroups: comp.lang.c Subject: Re: Paying attention to parentheses Message-ID: <1002@ubc-cs.UUCP> Date: Tue, 14-Apr-87 10:02:36 EST Article-I.D.: ubc-cs.1002 Posted: Tue Apr 14 10:02:36 1987 Date-Received: Sat, 18-Apr-87 00:19:15 EST References: <15958@sun.uucp> <5716@brl-smoke.ARPA> <532@omepd> <2094@mmintl.UUCP> Reply-To: manis@ubc-cs.UUCP (Vincent Manis) Organization: UBC Department of Computer Science Lines: 42 I think that this discussion is beginning (?!) to degenerate. For the record: 1) Compilers generally fall into three categories: student compilers, those with optional code improvers, and those with built-in optimisation. A student compiler will generally do no optimisation whatsoever, and therefore (except in obvious cases such as argument lists) what you see is what you get. An optional code improver (such as the one supplied with pcc) is not used by default, and therefore problems based on optimisation can be easily dealt with by comparing the optimised program with the unoptimised one. The third category, the really heavy-duty optimising ones, are certainly not recommended for casual or beginning programmers; even so, they generally have some way of disabling optimisation. So what's the problem? Just because ANSI relaxes the semantics of the language does not mean that a compiler has to be indeterminate. The standard (unless it's been changed over the last year or so) does not *demand* indeterminate order of evaluation. As a final point, if I got code from somewhere else, I would certainly not optimise it (even on UNIX) until I was sure that it was clean. 2) Frank Adams dislikes the +(...) syntax, and proposes the use of square brackets to denote a definite order of evaluation. I don't care for the monadic +, but why add yet more clumsy syntax? If you don't like the +, what's wrong with #define respect(x) (+(x)) Do all the people who are flaming on this subject understand that there are machines which don't do floating-point operations in the order specified, even if you write the code in assembly language? (Larger 370's certainly fall into this category; there is a certain type of NOP you write in order to establish a sequence point in assembly language). ----- Vincent Manis {seismo,uw-beaver}!ubc-vision!ubc-cs!manis Dept. of Computer Science manis@cs.ubc.cdn Univ. of British Columbia manis%ubc.csnet@csnet-relay.arpa Vancouver, B.C. V6T 1W5 manis@ubc.csnet (604) 228-6770 or 228-3061 "Long live the ideals of Marxism-Lennonism! May the thoughts of Groucho and John guide us in word, thought, and deed!"