precedence of ?: (was: precedence of && (was: precedence of ?:))

Larry Jones scjones at sdrc.UUCP
Sun Sep 17 06:17:20 AEST 1989


In article <11069 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
> So the interesting question becomes, why is that "expression" for the
> second operand of ?: and not "logical-OR-expression".  (I think that
> "conditional-expression" might result in ambiguity.)  The Rationale
> says merely that "several extant implementations have adopted this
> practice".  That must be the answer..

The answer is that the "?" and ":" are paired delimiters, just
like parentheses.  That means that you can put any arbitrary
expression between them without creating any ambiguity just like
you can put any arbitrary expression between "(" and ")".
----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at SDRC.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
"I have plenty of good sense.  I just choose to ignore it."
-Calvin



More information about the Comp.lang.c mailing list