Stefanie Ertheld said:
However, the question is probably more "why are non-short circuit
operators evaluated before short circuit operators?!
¯¯¯¯¯¯
Precendence of operators does not imply chronological sequence
of evaluation.
B and BCPL do not have a »||« operator.
In C, »&« is a bit-wise operator for integral types. When
0xffff & x || 0xffff & y
is used, can you guess, which precedence will be needed (wanted)
most of the time?
The precedence was chosen to minimize the need for parentheses.
C++ inherited it from C; Java inherited it from C++.
»Mihai Budiu: Can you tell us about the worse features of C,
from your point of view?
Brian Kernighan: [...] the precedences of some operators
are wrong, but those are trivial things and everybody's
learned to live with them.«
http://www.cs.cmu.edu/~mihaib/kernighan-interview/