Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Power proposal for ANSI C Summary: Side three Message-ID: <2422@haddock.ISC.COM> Date: 29 Jan 88 04:49:45 GMT References: <38384@sun.uucp> <2252@haddock.ISC.COM> <3421@ihlpf.ATT.COM> <2335@haddock.ISC.COM> <3474@ihlpf.ATT.COM> <3594@sdcc6.ucsd.EDU> <2397@haddock.ISC.COM> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 22 In article <2397@haddock.ISC.COM> karl@haddock.ima.isc.com (Karl Heuer) writes: >In article <3594@sdcc6.ucsd.EDU> ix426@sdcc6.ucsd.edu.UUCP (tom stockfish) writes: >>No, please don't propose this precedence ["*^" just above "*"]. Expressions >>like "-x*^2 + 5" will occur often and will make people hate C.... Any power >>operator proposal *must* get this one right... > >[The alternative is worse, so] it looks like the solution is to write your >example as either "5 - x*^2" or "-(x*^2) + 5" ... It occurs to me that there is a third plausible precedence, which does the "right" thing for the usual examples without breaking existing code. 1. postfix operators ("primary" and "postfix unary") 2. prefix operators other than unary minus 3. exponentiation 4. unary minus 5. multiplicative operators The drawback is that it creates *two* new precedence levels, by introducing exponentiation and splitting off unary minus. Is it worth it? I dunno. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint