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

Maarten Litmaath maart at cs.vu.nl
Fri Sep 15 07:41:32 AEST 1989


bill at twwells.com (T. William Wells) writes:
\...	a ? b : c = d
\
\can't be parsed as (a ? b : c) = d, since a ? b : c isn't a
\unary-expression. It can, however, be parsed as a ? b : (c = d). As
\far as I know, there are no compilers that this breaks on.
\
\Similarly one analyzes a && b = c:

STOP!  Let's do precisely what you said, let's analyze a && b = c
SIMILARLY:

	a && b = c

"can't be parsed as (a && b) = c, since a && b isn't a
unary-expression. It can, however, be parsed as a && (b = c). As
far as I know, there are no compilers that this breaks on."

But wait!  This example breaks on EVERY compiler!
-- 
   creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam:
      it shouldn't have existed at all.    |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.lang.c mailing list