>> [..regarding the precedence of && and || operators..]
>> Surely everyone knows that
>> true || false && false means true || (false && false) which == true.
>
> 1. Not everyone; see above. I honestly don't know, and I've been
> programming in C for almost thirty years. (I could learn the rule,
> but I have never needed to.)
>
> 2. I don't seem to be extreme; I don't use more parentheses than many
> others. (Although I prefer to introduce temporaries for complex
> expressions.)
>
> 3. Enough people seem to feel that way, or gcc wouldn't warn.
I have a different reaction. Certainly the attitude you describe
is common. That is regrettable, especially for these operators,
which are placed where many or most programmers would expect them
to be, following a well-established mathematical custom going back
at least to the 1800's. Moreover these particular operators have
the same relative precedence in essentially all programming
languages (the only exceptions I'm aware of are APL and Smalltalk,
which have just one precedence level for all binary operators).
[Note: strictly speaking I believe neither APL nor Smalltalk has
short-circuiting binary logical operators, but I'm glossing over
that aspect.]
More generally, this sentiment appears to be a holdover from a
time 60 years ago, when compilers, languages, and documentation
could not be trusted to be accurate or correct. To me it seems
like the same attitude that produces sloppy code, habits like
making arrays "a little bigger" than they need to be. The C
language has had exactly the same operator ordering for 40 years
(and maybe more, but K&R came out in 1978). Anyone who is capable
enough to be a competent programmer can easily learn those rules
in about 15 minutes. I believe the programming community would do
well to adopt the attitude that any serious C programmer should be
expected to have learned C's precedence rules (and similarly for
C++, at least for those parts where C and C++ are the same).
It could be helpful to have a "meeting-of-the-minds" discussion to
decide where the dividing line should be for which aspects should
be expected to be known and which are more esoteric. To me though
the relative precedences of relational/equality operators, the &&
operator, and the || operator, are clearly and emphatically well
inside the line of what should be expected of any serious C or C++
programmer.