How many bytes is unsigned long long
? Is it the same as unsigned long long int
?
The answer is definitively YES.
Executive summary: it's 64 bits, or larger.
unsigned long long
is the same as unsigned long long int
. Its size is platform-dependent, but guaranteed by the C standard (ISO C99) to be at least 64 bits. There was no long long
in C89, but apparently even MSVC supports it, so it's quite portable.
In the current C++ standard (issued in 2003), there is no long long
, though many compilers support it as an extension. The upcoming C++0x standard will support it and its size will be the same as in C, so at least 64 bits.
You can get the exact size, in bytes (8 bits on typical platforms) with the expression sizeof(unsigned long long)
. If you want exactly 64 bits, use uint64_t
, which is defined in the header <stdint.h>
along with a bunch of related types (available in C99, C++11 and some current C++ compilers).
The beauty of C++, like C, is that the sized of these things are implementation-defined, so there's no correct answer without your specifying the compiler you're using. Are those two the same? Yes. "long long" is a synonym for "long long int", for any compiler that will accept both.
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