Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!burl!codas!cpsc6a!rtech!jas From: jas@rtech.UUCP Newsgroups: comp.lang.c Subject: Re: Unary plus (and wysiwyg order or evaluation) Message-ID: <752@rtech.UUCP> Date: Fri, 10-Apr-87 12:52:50 EST Article-I.D.: rtech.752 Posted: Fri Apr 10 12:52:50 1987 Date-Received: Sun, 12-Apr-87 01:30:59 EST References: <6772@brl-adm.ARPA> <803@viper.UUCP> Reply-To: jas@rtech.UUCP (Jim Shankland) Organization: Relational Technology, Alameda CA Lines: 37 Sorry to add to a discussion that may have gone on too long; I'll be brief. Postings like this betray some confusion: >>>... it is not a _minor_ matter when something like the proposed unary >>>plus override on parenthesis evaluation order is added to a language. >> >>... I didn't even realize my parentheses weren't being honored. Seriously. > > It wasn't until reading about unary '+' that i knew that C might > disregard my parens. >I think parens should be followed without any micky-mousing from the compiler. PARENTHESES AFFECT PRECEDENCE, NOT EVALUATION ORDER. THESE ARE 2 DIFFERENT THINGS. To put it another way, parentheses affect the shape of the parse tree for an expression; evaluation order is an order in which the parse tree is walked. Unary '+' does not "override" parentheses, nor may a compiler "disregard my parens." Parens have a precise and essential function, entirely distinct from order of evaluation. If you want to give the programmer some control over evaluation order (a reasonable thing), some options for C are: (1) Force the programmer to explicitly use temporaries (the current solution); (2) Allow unary '+' as an order-of-evaluation directive (the ANSI C solution); (3) Come up with some other syntax for order-of-evaluation directives. People may argue over which of these options is most reasonable. What is NOT reasonable is to use parentheses as an order-of-evaluation directive. They are already taken, for altering operator precedence. Is the distinction really so difficult to understand? -- Jim Shankland ..!ihnp4!cpsc6a!\ rtech!jas ..!ucbvax!mtxinu!/