I have no authoritative answer as to why K & R chose the priority they made. One example that would make a lot of sense would be:
if (x == 1 & y == 0) { }
Since this is a bitwise AND operator, it uses the evaluation mode without short circuit, as
if (x == 1 | y == 0) { }
use the short circuit operator OR. This is probably why they chose the priority group this way, but I agree with you that in retrospect this does not seem to be a good idea.
templatetypedef Jan 13 '11 at 20:52 2011-01-13 20:52
source share