& has &&. | has ||. Why doesn\'t ^ have ^^?
I understand that it wouldn\'t
Dennis Ritchie answers
There are both historical and practical reasons why there is no
^^operator.The practical is: there's not much use for the operator. The main point of
&&and||is to take advantage of their short-circuit evaluation not only for efficiency reasons, but more often for expressiveness and correctness.
[...]
By contrast, an^^operator would always force evaluation of both arms of the expression, so there's no efficiency gain. Furthermore, situations in which^^is really called for are pretty rare, though examples can be created. These situations get rarer and stranger as you stack up the operator--if (cond1() ^^ cond2() ^^ cond3() ^^ ...) ...does the consequent exactly when an odd number of the
condx()s are true. By contrast, the&&and||analogs remain fairly plausible and useful.