Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!sri-unix!teknowledge-vaxc!uw-beaver!tektronix!reed!psu-cs!omepd!jimv From: jimv@omepd.UUCP Newsgroups: comp.lang.c Subject: Re: C & fp (really parens) Message-ID: <549@omepd> Date: Fri, 10-Apr-87 00:46:43 EST Article-I.D.: omepd.549 Posted: Fri Apr 10 00:46:43 1987 Date-Received: Sat, 11-Apr-87 14:30:17 EST References: <6800@brl-adm.ARPA> Reply-To: jimv@omepd.UUCP (Jim Valerio) Organization: Intel Corp., Hillsboro Lines: 31 Summary: some improvements are no improvement at all In article <6800@brl-adm.ARPA> dsill@NSWC-OAS.arpa writes: >Given that a means for forcing the compiler to respect parentheses is needed, >couldn't something less syntactically "tacky" than the unary + have been found? >I don't think it's intuitive or obvious. Someone, I don't remember who, >suggested a "respect" reserved word to be used as: > respect x = expression...; >which wouldn't be too bad. I'm sorry, but "respect ..." doesn't seem like an improvement over the unary + syntax to me. (There's a Rodney Dangerfield joke in here somewhere.) An alternate approach is to write a preprocessor to run over the C code that enforces parentheses by rewriting those expressions as individual statements to guarantee the order of evaluation. I grant that some rewrites are tricky to do since expressions and statements don't always mix well in C, but this approach does enforce the order of evaluation. One gotcha might be that, to get reasonable code generated, the rewriting could require declaring extended-width floating-point data types (such as long double) which may or may not be supported in any particular compiler. I'm thinking here of those floating-point chips that prefer to keep intermediate expressions in an extended-width format. I consider the rewriting approach to be somewhat similar to the inline function preprocessor I've been using here. Source level rewriting is useful, and can be done separately from the compiler, but it is easier to directly implement the desired semantics in the compiler proper. -- Jim Valerio {verdix,intelca!mipos3}!omepd!jimv, jimv@omepd.intel.com