|
|
|
|
|
by masklinn
2552 days ago
|
|
> It's not the same as warning on "if (a=b)" as someone replied. "if (a=b)" uses the "=" operator exactly as intended with perfectly legitimate uses. It's warned about because it's an error-prone construct, not because it's incorrect. Seems to me 2^32 is also error-prone, if you wanted to combine flags you'd use 2|32, using xor here is weird. |
|
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.