I see the
#define NUM_MAX_VOLUME 0ui64
in other people's code
What is the number 0ui64? It seems it is not a hex number though.
I am surpsised that there are many answers, but none has pointed out the official and authoritative documentation that should be noted in my opinion, so here goes the MSDN documentation:
unsigned-suffix: one of
u U
and
64-bit integer-suffix:
i64 LL ll
So, it is indeed not a hexa number, but basically a macro define to zero that represents an unsiged 64 bit integer number. Please note that 0Ui64
, 0ULL
, 0ull
, etc, would be all the same, too.
This is necessary when you want to make sure that the sign and size are fixed so that it cannot go unexpected or undefined behavior.
This is neither standard C++, nor C, but a Microsoft compiler feature. Try to avoid it.
Since your question is tagged as Qt, the recommendation is to use quint64 and Q_UINT64_C instead which will work cross-platform. So, you would write something like this:
#define NUM_MAX_VOLUME Q_UINT64_C(0)
"ui64" means unsigned 64-bit integer. It is a non-standard suffix in some cases. "0ui64" is just 0, and i guess the reason to write like this is for compatibility.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With