devxlogo

Eight-Byte Data Types

Eight-Byte Data Types

Question:
I am looking for a data type in C++ that takes eight bytes. I have tried long, long int, and so forth, but they are all four bytes on Windows NT. I need an eight-byte integer datatype for some encryption algorithm. Could you tell me what to do?

Answer:
Standard C++ does not define an eight-byte integer type. However, this situation will change pretty soon, because C9X (the new C draft standard) now defines the “long long” data type, which is a 64-bit integer.

In practice, most C++ compilers already define a non-standard integer type that holds eight bytes. Visual C++, for instance, defines __int64 and __uint64 for signed and unsigned eight-byte integers, respectively. You can use these types on Windows NT.

devx-admin

Share the Post: