Pcc bites it (was Re: programming puzzle (silly))

Tim_CDC_Roberts at cup.portal.com Tim_CDC_Roberts at cup.portal.com
Sat Mar 18 03:31:57 AEST 1989


In <2550086 at hpisod2.HP.COM>, decot at hpisod2.HP.COM (Dave Decot) writes:

>>    (n&&m) *= n--
> ... doesn't have two different valid interpretations, so it's not
> ambiguous, so the precedence rules are not applicable.

I disagree with this statement.  The parser does not necessarily have
any knowledge about whether a construct is _semantically_ valid.  It
is attempting to make a _syntactically_ valid interpretation, and BOTH
interpretations [ (n&&m) *= n--  vs.  n && (m*=n--) ] are syntactically
valid.

I say this tentatively - I've written compilers, but not a C compiler.
I would appreciate an opinion by a C compiler writer.

Tim_CDC_Roberts at cup.portal.com                | Control Data...
...!sun!portal!cup.portal.com!tim_cdc_roberts |   ...or it will control you.



More information about the Comp.lang.c mailing list