6 ms·
'If' expects a condition so finding an assignment may be a red flag even if an assignment has a return value in the spec, which makes the construct valid. On t
by NotPaidToPost 7y ago
'If' expects a condition so finding an assignment may be a red flag even if an assignment has a return value in the spec, which makes the construct valid.
On the other hand ^ expects integers so 2^32 is exactly what is expected.
Most the replies I saw here try to second-guess or claim that ^ should be used in a specific way. Not so, ^ is just doing XOR of two integers.
Apparently, I am having an incorrect opinion, though, so I will self-censor and remain silent.
- CJefferson 7y agoYou don't have to enable warnings, but most c programmers do. The problem is, what proportion of 2^32 in C are correct? I'm will to bet it is as close to 0 as doesn't matter. The gcc devs aren't stupid, before enabling a warning like this, they will run a test compiling a substasal chunk of debian, and see if there are any false positives.
- mikeash 7y agoIf expects an integer, and = produces an integer when the lhs has integer type.