Maximum value for unsigned int ?
-
Hello,
qDebug() << QString::number(std::numeric_limits<unsigned int>::max());
return 4294967295 with my mac OS X[64 bits]. Is it the same for all target platforms of Qt ?
In other words, can is it the same value with windows 32&64, linux 32&64, ios, android ? I guess so, but I prefer to check with you ?
Thanks. Regards. Gilles -
Hello,
qDebug() << QString::number(std::numeric_limits<unsigned int>::max());
return 4294967295 with my mac OS X[64 bits]. Is it the same for all target platforms of Qt ?
In other words, can is it the same value with windows 32&64, linux 32&64, ios, android ? I guess so, but I prefer to check with you ?
Thanks. Regards. Gilles -
@J.Hilk said in Maximum value for unsigned int ?:
sadly you can not, the standard int may have 2 or 4 bytes depending on the platform/compiler used.
but you can ensure, that it is 4 bytes, by using int32_t or qint32Hello,Thank you for your reply. Could you clarify me in which case is it 2 bytes on the platforms mentioned ?
Thanks. Gilles -
Actually, as I discovered with surprise, Qt only supports systems where
int
is 4 bytes so yes, that result is guaranteed.The difference between 64 and 32 bits versions is the definition of qintptr
@VRonin said in Maximum value for unsigned int ?:
Actually, as I discovered with surprise Qt only supports systems where
int
is 4 bytes so yes, that result is guaranteed.Look at that, you learn something new every day 😲!