|
|
Joined: Feb 2004
Posts: 2,603 Likes: 307
Very Senior Member
|
Very Senior Member
Joined: Feb 2004
Posts: 2,603 Likes: 307 |
I'm also getting this as a warning now:
src/osd/interface/inputcode.h:382:36: warning: result of comparison of constant 15 with expression of type 'input_device_class' is always true [-Wtautological-constant-out-of-range-compare]
assert(devclass >= 0 && devclass <= 0xf);
~~~~~~~~ ^ ~~~
Is it making the assumption there that the enum can only hold a defined enumerated value? That’s going to make trouble for all our bitfield enums if that assumption spills over into code generation.
|
|
|
|
Joined: Apr 2005
Posts: 616 Likes: 6
Senior Member
|
Senior Member
Joined: Apr 2005
Posts: 616 Likes: 6 |
The input_device_class enum only has 9 defined values so it is assuming that the value it holds is always <=15, which sounds pretty reasonable from a compiler point of view...
|
|
|
|
Joined: Mar 2001
Posts: 17,234 Likes: 259
Very Senior Member
|
OP
Very Senior Member
Joined: Mar 2001
Posts: 17,234 Likes: 259 |
Yeah, one of the things I fixed earlier in this thread was like that. If you pass a value as an enum type it's gonna assume only the defined values are valid. Which is definitely smarter than compilers used to be about that stuff.
|
|
|
2 members (Duke, anoid),
183
guests, and
1
robot. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,328
Posts122,128
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|
|