https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90885

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #11)
> Warning for "2 ^ INT" seems reasonable, maybe just for that (I think I agree
> with comment #6).
> 
> Not sure what to call it: "-Wexclusive-or"???

I suppose -Wxor is a bit cryptic-lookin'

What about -Wxor-used-as-pow ?

> I think we'd want to *not* warn if either of the operands are from a macro
> expansion.
> 
> I think both operands ought to be decimal integers to trigger the warning.

And not warn if the C++ 'xor' keyword is used, as nobody's going to think that
"2 xor 8" means raising to the 8th power.

> I like the wording from comment #2: "2 ^ 30 is 28, not 1073741824.", to make
> it clear what's going on (I hope).

Yes, that's also how I phrased the various pull requests and bug reports I've
submitted today.

Reply via email to