Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!usc!ginosko!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re: precedence of && (was: precedence of ?:) Message-ID: <3260@solo5.cs.vu.nl> Date: 14 Sep 89 18:13:37 GMT References: <1265@gmdzi.UUCP> <11030@smoke.BRL.MIL> <11039@smoke.BRL.MIL> <3236@solo10.cs.vu.nl> <11045@smoke.BRL.MIL> <3242@solo12.cs.vu.nl> <11054@smoke.BRL.MIL> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 30 gwyn@smoke.BRL.MIL (Doug Gwyn) writes: \... 0 && (i = 0) \... \Actually, now that I've gotten back to my desk where I keep a copy of \the proposed Standard, I find that you must supply the parentheses to \get a legal parse. Without them there is no derivation from the \grammar production rules. (I think. I keep getting this wrong.) You're right, according to the January '88 :-( copy of the dpANS I have at home. [... 0 ? 0 : i = 0 is accepted, whereas 0 && i = 0 is not.] \Maybe the intention is to avoid confusion. For example, \ i = 0 && i = 0 \would either have to have an ambiguous parse, or else its interesting \subexpression would be parsed differently depending on context, which \is confusing. [...] Allright, let's avoid the confusion; another example: a + b = 7 But why allow the `?:' expression, why make it a special case? -- creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam: it shouldn't have existed at all. |maart@cs.vu.nl, mcvax!botter!maart