Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: precedence of ?: Message-ID: <11030@smoke.BRL.MIL> Date: 12 Sep 89 03:08:41 GMT References: <1265@gmdzi.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <1265@gmdzi.UUCP> wittig@gmdzi.UUCP (Georg Wittig) writes: -How should - 0 ? 0 : i = 0 -be interpreted? -1) as (0) ? (0) : (i=0) - resulting in a (strange but) legal expression -or 2) as (0 ? 0 : i) = 0 - resulting in a syntax error The latter is the correct parse. See the table on p. 49 of K&R I. As you note, it is an unwell-formed formula. -Existing compilers don't agree on which alternative is the correct one. Well, they ought to. See the table on p. 49 of K&R I.