
On Wed, Apr 30, 2014 at 2:33 PM, Daniel Fischer < daniel.is.fischer@googlemail.com> wrote:
x & 0xF == 0xF has only 1 meaningful interpretation; C chooses the other! The error comes (probably) from treating & as close to the logical operators like && whereas in fact it is more kin to arithmetic operators like +.
That comes from `&` and `|` being logical operators in B. Quoth Dennis Ritchie (http://cm.bell-labs.com/who/dmr/chist.html in the section "Neonatal C"):
to make the conversion less painful, we decided to keep the precedence of the & operator the same relative to ==, and merely split the precedence of && slightly from &. Today, it seems that it would have been preferable to move the relative precedences of & and ==, and thereby simplify a common C idiom
Nice! I learn a bit of history. Hope we learn from it! viz. Some things which are easy in a state of transition become painful in a (more) steady state.