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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The right heuristic for the warning isn't entirely obvious though.

I think it should only warn when both operands are integer literals. Should all
kinds of integer literals be treated equally? Is 0x11 ^ 0b0011 wrong? Maybe not
as obviously as 2^8 and 2^32.

Do these mistakes only happen for powers of 2 and powers of 10? Is it worth
warning about 3^4?

After some more searches I'm not even sure 10^ is common enough to worry about.
Maybe it should only warn for 2 ^ integer-literal.

Warning X^X where the same literal is given twice probably makes sense, that
would catch the 10^10 case in comment 1 (but not the -10^10 one).

Reply via email to