Bitwise operator predence
问题 A gotcha I've run into a few times in C-like languages is this: original | included & ~excluded // BAD Due to precedence, this parses as: original | (included & ~excluded) // '~excluded' has no effect Does anyone know what was behind the original design decision of three separate precedence levels for bitwise operators? More importantly, do you agree with the decision, and why? 回答1: The operators have had this precedence since at least C. I agree with the order because it is the same relative