Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!apollo!wanginst!mckeeman From: mckeeman@wanginst.UUCP Newsgroups: comp.lang.c Subject: Re: Paying attention to parentheses Message-ID: <1021@wanginst.EDU> Date: Wed, 15-Apr-87 21:56:00 EST Article-I.D.: wanginst.1021 Posted: Wed Apr 15 21:56:00 1987 Date-Received: Sat, 18-Apr-87 08:31:15 EST References: <15958@sun.uucp> <5716@brl-smoke.ARPA> <532@omepd> <2094@mmintl.UUCP> <1002@ubc-cs.UUCP> Organization: Wang Institute Lines: 38 Summary: optimization is not always optional In article <1002@ubc-cs.UUCP>, manis@ubc-cs.UUCP (Vincent Manis) writes: > 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... Let me define "plain code" for C expressions: Operands are evaluated left-to-right, Operations are associated with operands as defined by the parse tree, Side effects are executed with the operation causing them, and The representation of an intermediate result is identical to the representation of that same value in a variable of the same type. Relative to that definition, it is my opinion that all compilers do some non-intuitive optimization *all* the time. What a programmer using -O really is saying is "I'm willing to wait a while for even better code". If programmers need something between "plain code" and "highly optimized code", compiler writers are going to have to have a better definition of it. Anyone want to try a definition of "reasonable code" for: 1. floating point expressions 2. overflow-vulnerable integer expressions 3. expressions subject to debugger and postmortem peeking. 500 words or less per entry please. :-) /s/ Bill p.s. The K&R grammar is deliberately ambiguous, defeating the above definition of plain code; plain code does make sense relative to the x3j11 grammar. -- W. M. McKeeman mckeeman@WangInst Wang Institute decvax!wanginst!mckeeman Tyngsboro MA 01879