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

Dominik Czarnota <dominik.b.czarnota+bugzilla at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dominik.b.czarnota+bugzilla
                   |                            |@gmail.com

--- Comment #19 from Dominik Czarnota <dominik.b.czarnota+bugzilla at gmail dot 
com> ---
Also what if:

1. Someone does it through DEFINEs as in:
```
#define COMPUTING_BASE 2
#define BITS 32
// and later use
COMPUTING_BASE ^ (BITS-1)
```
I guess we will warn.

2. Someone does it through constexpr variables in C++, as in:
```
constexpr int COMPUTING_BASE = 2;
constexpr int BITS = 32;
// and later use
COMPUTING_BASE ^ (BITS-1)
```
This probably happens on a different level than the above, so we probably won't
warn as it doesn't use integer literals?

3. Someone *really wants it*?
Maybe there should be a way to inform the compiler, e.g. via a comment to
suppress the warning for a given line? For example:
```
printf("%d\n", 2^32 /* explicit-xor */);
```

Offtopic: if you care about adding more warnings in tragic situations, you
might also want to look at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88000
;)

Reply via email to