Precedence Question - (nf)

johnl at haddock.UUCP johnl at haddock.UUCP
Tue Feb 14 14:38:18 AEST 1984


#R:smu:13800001:haddock:12400004:000:480
haddock!johnl    Feb 13 15:18:00 1984

In regard to this:

	cat = foo ? fu = bar : mouse;

Precedence has nothing to do with it.  Precedence only matters when there
are two possible legal parses, such as "a + b * c" which could be either
"(a + b) * c" or "a + (b * c)" without precedence to disambiguate.

The only possible parse for the first expression is:

	cat = foo ? (fu = bar) : mouse;

so that the "fu = bar" assignment happens before the assignment to cat
if it happens at all.  Golly.

John Levine, ima!johnl



More information about the Comp.lang.c mailing list