precedence of ?:
Doug Gwyn
gwyn at smoke.BRL.MIL
Tue Sep 12 13:08:41 AEST 1989
In article <1265 at gmdzi.UUCP> wittig at 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.
More information about the Comp.lang.c
mailing list