Re: precedence

From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 09/15/04


Date: Wed, 15 Sep 2004 09:52:15 +0100

In article <MoOdnel-ku5oE9rcRVn-hw@comcast.com>, Gary Labowitz
<glabowitz@comcast.net> writes
>What ever happened to common sense? The table is supposed to help apply
>common sense.
  But this is an example of why precedence tables are only an
approximation, you have to know and understand the grammar.

It is easy for even the world's best to get caught. The very first
printing of The C++ Programming Language 3rd ed. had a misleading in its
precedence table. The conditional operator (? :) cannot be placed
correctly in such a table because of conflict with the precedence of
assignment expressions.

The upshot is that any precedence table for C++ operators has to be
treated as a guide rather than as definitive.

-- 
Francis Glassborow      ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects


Relevant Pages

  • Re: Separation of concerns
    ... Correction. ... Separation of concerns *is* common sense. ... question of precedence between them. ...
    (comp.object)
  • Re: Conditional operator
    ... its precedence: just higher than assignment. ... Are you using the return value from the conditional operator? ... code needed them: The precedence of ?: binds more tightly to its ...
    (perl.beginners)
  • Re: Yes/No
    ... In fact both will generate compilation error. ... Since precedence of conditional operator is higher than ... assignement operator, the following statement ...
    (comp.lang.c)