Previous Thread
Next Thread
Print Thread
Page 2 of 2 1 2
Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
Originally Posted by AJR
I'm also getting this as a warning now:

Code
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
Offline
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
R
Very Senior Member
OP Online Content
Very Senior Member
R
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.

Page 2 of 2 1 2

Link Copied to Clipboard
Who's Online Now
2 members (Duke, anoid), 183 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,328
Posts122,128
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com