I got following warnings for the enum value xxxxx920P4
building a qt C++ project. And I found out in the debugging that xxxxx920P4
is now equals to xxxxxundefine
(0x00000000
), which causes the unexpected result. How should I resolve this problem?
I'm using Qt version: 4.8.7 and Visual studio 2010.
The following loop will not be executed. gVersions[0].verNum
is "xxxxx920P4"
, so I guess "xxxxx920P4"
's value has been truncated and now it equals to 0x00000000
.
for(int i=0; gVersions[i].verNum != xxxxxundefine ; i++)
{
}
Doc for Qt Qflags class: https://doc.qt.io/qt-5/qflags.html
warning C4341: 'xxxxx920P4' : signed value is out of range for enum constant
warning C4309: 'initializing' : truncation of constant value
enum Version
{
xxxxxundefine = 0x00000000,
xxxxx400 = 0x00000001,
xxxxx401 = 0x00000002,
xxxxx410 = 0x00000004,
xxxxx411 = 0x00000008,
xxxxx412 = 0x00000010,
xxxxx420 = 0x00000020,
xxxxx430 = 0x00000040,
xxxxx431 = 0x00000080,
xxxxx432 = 0x00000100,
xxxxx440 = 0x00000200,
xxxxx500 = 0x00000400,
xxxxx510 = 0x00000800,
xxxxx520 = 0x00001000,
xxxxx521 = 0x00002000,
xxxxx600 = 0x00004000,
xxxxx611 = 0x00008000,
xxxxx620 = 0x00010000,
xxxxx621 = 0x00020000,
xxxxx700 = 0x00040000,
xxxxx910 = 0x00080000,
xxxxx910P5 = 0x00100000,
xxxxx910P6 = 0x00200000,
xxxxx910P11 = 0x00400000,
xxxxx910P12 = 0x00800000,
xxxxx910P13 = 0x01000000,
xxxxx910P14 = 0x02000000,
xxxxx910P15 = 0x04000000,
xxxxx910P16 = 0x08000000,
xxxxx920 = 0x10000000,
xxxxx920P1 = 0x20000000,
xxxxx920P2 = 0x40000000,
xxxxx920P3 = 0x80000000,
xxxxx920P4 = 0x100000000,
}; Q_DECLARE_FLAGS(Versions, Version)