bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ambigious ++ expression silently accepted


From: Paul Eggert
Subject: Re: ambigious ++ expression silently accepted
Date: Tue, 13 Dec 2005 10:41:41 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

"Andrew J. Schorr" <address@hidden> writes:

> But that URL contains a table entitled: 
> "Table: Expressions in Decreasing Precedence in awk".  And
> that table clearly lists "Pre-increment" as having higher
> precedence than "Post-increment".

No, the HTML is corrupted in that URL.  The actual table (I have a
printed copy of page 168 of IEEE Std 1003.2-1992, and this part hasn't
changed) shows that ++lvalue and lvalue++ have the same precedence,
since they are in the same group between horizontal lines.

Even the PDF version of IEEE Std 1003.1-2001/Cor2-2004 is wrong: the
lines are missing.  I just now reported this as a bug; see
<https://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-review-l&id=1981>.

But, even if ++x had higher priority than x++, that wouldn't matter.
Both parses would still be valid according to the existing grammar,
and both parses would obey the precedence rules, since they both would
group ++ more tightly than concatenation.

> shouldn't the
> expression be parsed as (foo (++bar))?

The current grammar is ambiguous, so that would be a valid parse, yes.
As it stands, "foo++bar" is not a portable expression, since the standard
is ambiguous.

> So is this a bug in gawk?

I don't think so.  I think it's a bug in the standard.  I reported it
as well; see
<https://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-review-l&id=1982>.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]