Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mimsy!chris From: chris@mimsy.UUCP Newsgroups: comp.lang.c Subject: Re: ANSI, Parens, Unary Plus, and a change of opinion. Message-ID: <6308@mimsy.UUCP> Date: Thu, 16-Apr-87 23:05:01 EST Article-I.D.: mimsy.6308 Posted: Thu Apr 16 23:05:01 1987 Date-Received: Sat, 18-Apr-87 04:37:28 EST References: <800@kodak.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 40 Keywords: Parens, unary Plus, standard, optimization In article <800@kodak.UUCP>, grodberg@kodak.UUCP (Jeremy Grodberg) writes: > There remains, however, a need for the programmer to be able to >specify the order of evaluation in a number of cases. Agreed (by all, I hope). >While this can currently be achieved with the use of explicit >temporaries, that method is cumbersome and inefficient. ANSI has >proposed that the unary plus operator be given the side effect of >causing early evaluation, It is not a side effect: Unary plus is not listed in the set of `commutative and associative' operators, and only those may be rearranged. (This seems a minor point, but I think it is a key one in understanding *why* the dpANS uses it.) >... many people, myself included, feel that the unary plus is a >kludge, ugly, inappropriate, confusing, etc. It is certainly ugly. > ***PROPOSAL*** > At the risk of making C still more complicated, I propose that the >operators "(:" and ":)" be added and do for order of evaluation what >"(" and ")" do for order of precedence. I would much prefer expressions bracketed with `[' and `]', if anything is to be added. (No matter what is done, unary plus will still be available, for monadic operators can be neither commutative nor associative. If nothing else, it will at least be possible to write a translator that turns `[e1] op e2' into `+(e1) op e2'.) I would suggest that those who wish to see something added---whether it be [expr] or (:expr:) or whatever else---should modify a compiler *now* and try converting some numerical analysis software to this new form. *Any* positive experience will help convince X3J11 members that the change is beneficial. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu