Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830713); site tjalk.UUCP Path: utzoo!linus!decvax!mcvax!vu44!tjalk!dick From: dick@tjalk.UUCP (Dick Grune) Newsgroups: net.lang.c Subject: Re: a ? b = c : d, and what the Manual says Message-ID: <307@tjalk.UUCP> Date: Wed, 21-Mar-84 08:09:27 EST Article-I.D.: tjalk.307 Posted: Wed Mar 21 08:09:27 1984 Date-Received: Sat, 24-Mar-84 16:34:27 EST Organization: VU Informatica, Amsterdam Lines: 43 Since here in Europe the net news often arrives a bit late, I generally do not bother to answer, because anything I may have to contribute usually appears repeated N times in the next few rounds of news. Nevertheless, in the protracted discussion about the acceptability of a == b ? c = d : e = f I have not to date seen the essential remark that the reference manual answers the question, so here I go. I quote (RM 7, first paragraph): "The precedence of ... operators is the same as the order of the major subsections... . Thus, for example, the expressions referred to as the operands of + ($7.4) are those defined in $$7.1-7.3." This effectively says how to expand the grammar in the manual to obtain a more complete one. For $7.13 this expansion results in: conditional_expression: expression7_13 ? expression7_13 : expression7_13 expression7_13: logical_or_expression /* 7.12 */ logical_and_expression /* 7.11 */ ... unary_expression /* 7.2 */ primary_expression /* 7.1 */ This grammar does not produce a == b ? c = d : e = f and you may draw your conclusions from that. If this has been on the net, the news just hasn't come to me, and I apologize for wasting time and bandwidth. Dick Grune Vrije Universiteit Amsterdam And my name isn't Richard!