2 ms·
The point is very specifically cases where X is a decimal literal (not an expression such as 1 << x, or a hex number). Things that resolve to this don't trigg
by rocqua 7y ago
The point is very specifically cases where X is a decimal literal (not an expression such as 1 << x, or a hex number).
Things that resolve to this don't trigger the warning, and it is a compile time warning.
And then specifically looking at 2^X and 10^X occurring in source code.
- raxxorrax 7y agoI would agree with the suggestion then. It can happen that you just write it out like that and the compiler should maybe inform me. But why limit it to 2^ and 10^ and not say literal^literal should always produce a warning? Any common or valid usages that I am missing here?
- NotPaidToPost 7y ago> But why limit it to 2^ and 10^ and not say literal^literal should always produce a warning? You're suggesting that using the C language as specified and intended should produce a warning... That makes no sense.
- rocqua 7y agoCertainly, I'd say if either side is a hex or octal literal, it might be someone intentionally bit-twideling. As for limiting the base, that is a more fluid matter. I guess you want to avoid warnings for very large numbers. Because those are more likely legitimate.