Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.UUCP (Rahul Dhesi) Newsgroups: comp.lang.c Subject: Re: parens honored Keywords: ANSI C standard Message-ID: <1798@bsu-cs.UUCP> Date: 7 Jan 88 21:18:47 GMT References: <6829@brl-smoke.ARPA> <2845@zeus.TEK.COM> <6860@brl-smoke.ARPA> <12211@orchid.waterloo.edu> <6968@brl-smoke.ARPA> Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 32 In article <6968@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: [about new restriction on rearrangement of parens in ANSI C] >Hey, a lot of the committee didn't mind the way it was, but in the >end it was decided to help the programmer rather than the implementor. >I for one appreciate having my expressed algorithmic intentions >carried out precisely, instead of the compiler taking it upon itself >to "improve" things for me in ways that make my code unreliable. Isn't it true though that in pre-ANSI K&R C, one could force a certain order of evaluation through the use of temporary variables, thus getting the best of both worlds? ANSI C takes away this ability from the user. The new rule gives BOTH the programmer and the implementor fewer options. The unary plus, ugly though it was, did not take away anything from the programmer and almost certainly was a smaller burden on the compiler writer for a machine doing overflow checking than was having to figure out when rearrangement of parens could change overflow behavior. [wild speculation follows] It also will be a potential headache to the hardware designer who was about to include automatic overflow checking into his CPU, a definite plus in many cases, who now realizes that this could mean that his company's C compiler will now show up badly in benchmarks against his competitors who saved money by not having their hardware check for integer overflow. For his C compiler can now no longer simplify many macro expressions. So he may decide to forget overflow checking. Thus the parens rule acts to make expensive in software a useful feature that was already expensive in hardware. A double whammy with no winners, only losers. -- Rahul Dhesi UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!dhesi