Is there a C++ variant for the long
primitive data-type?
A C++ long
is only 4 bytes, while a Java long
is 8 bytes.
So: Is there a non-decimal primitive type with a size of 8 bytes in C++?
Maybe with some tricks?
Thanks
Is there a C++ variant for the long
primitive data-type?
A C++ long
is only 4 bytes, while a Java long
is 8 bytes.
So: Is there a non-decimal primitive type with a size of 8 bytes in C++?
Maybe with some tricks?
Thanks
C++ has a long long
type, with a length of 64 bits (on most platforms).
Microsoft Visual C++ defines an __int64
type that's equivalent to Java's long
. gcc has int64_t
. There's even a long long int
type defined in the ISO C99 standard, however according to the standard it's at least 64 bits wide, but could be wider.
But apart from the size, there's also endianness to consider. The Java standard mandates big endian, but with C, endianness is AFAIK always platform-dependant.