[PATCH] D66397: [Diagnostics] Improve -Wxor-used-as-pow

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 11:31:29 PDT 2019


thakis added a comment.

>> I think I missed the workaround. I only saw the suggestion to write 0x2 instead of 2 which doesn't seem more clear at all to me. Was there another fix suggestion?
> 
> Nope, you didn't miss it -- that was the suggestion. Using a hex notation is the way we let programmers signify that they want to do bit fiddling.

Sorry, I don't buy that :) If I wasn't aware it's there to suppress a warning, if I saw `0x2` I'd think the author of that was confused about what the `0x` prefix does. Maybe a better fixit is to suggest `xor` instead of `^` which also suppresses the warning and which is imho a bit less weird. (`xor` is so rare that it's still a bit weird though.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66397/new/

https://reviews.llvm.org/D66397





More information about the cfe-commits mailing list