Can parentheses in C change the result type of operands of a bitwise operation?
问题 I have fed the following code through a static analysis tool: u1 = (u1 ^ u2); // OK u1 = (u1 ^ u2) & u3; // NOT OK u1 = (u1 ^ u2) & 10; // NOT OK u1 = (u1 ^ u2) & 10U; // NOT OK u1 = (unsigned char)(u1 ^ u2) & 10U; // OK u1 = (unsigned char)(u1 ^ u2) & u3; // OK "OK" means the static analysis tool did not complain. "NOT OK" means the static analysis tool did complain -- claiming that some operand of a bitwise operation is not an unsigned integer. The results from the last 2 lines show that