int64_t == long long
John Love-Jensen
eljay@adobe.com
Tue Jul 1 19:33:00 GMT 2008
On 7/1/08 2:17 PM, "Yang Zhang" <yanghatespam@gmail.com> wrote:
> Hi, why isn't int64_t == long long at least on 64-bit x86 Linux?
Because int64_t should be 64-bit, but long long could be 64-bit or larger.
#include <stdint.h> // from C99
#include <climits>
cout << (sizeof(int64_t) * CHAR_BIT) << endl;
cout << (sizeof(long long) * CHAR_BIT) << endl;
You can also do this:
#include <stdint.h> // from C99
#include <typeinfo>
cout << typeid(int64_t).name() << endl;
cout << typeid(long long).name() << endl;
> How do I tell what type this actually is?
typeid
> And are literals ending with LL always long long?
Yes, that's what the LL suffix means.
So the literal integer numerics are:
'A'
L'A'
65
65L
65LL
65U
65UL
65ULL
Keep in mind the portability issues surrounding use of long long, LL, and
ULL. You may want to use the <stdint.h> INT64_C and UINT64_C macros to
construct your numeric literals.
INT64_C(65)
UINT64_C(65)
HTH,
--Eljay
More information about the Gcc-help
mailing list