Maximum value for unsigned int ?
-
wrote on 13 Sept 2018, 09:04 last edited by Selzig
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. Gilleshi @Selzig ,
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
orqint32
-
wrote on 13 Sept 2018, 09:14 last edited by
@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 -
wrote on 13 Sept 2018, 09:23 last edited by VRonin
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
-
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 😲!
-
wrote on 13 Sept 2018, 09:36 last edited by
Thank you both for this informations.
Regards. Gilles
1/6