Re: int64_t == long long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Love-Jensen wrote:
On 7/1/08 2:17 PM, "Yang Zhang" <yanghatespam@xxxxxxxxx> 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;

  cout << sizeof(int64_t) << endl;
  cout << sizeof(long long) << endl;

print:

8
8


You can also do this:

#include <stdint.h> // from C99
#include <typeinfo>

cout << typeid(int64_t).name() << endl;
cout << typeid(long long).name() << endl;

This prints:

l
x

What does this mean?  (typeid(string).name() prints "Ss")

--
Yang Zhang
http://www.mit.edu/~y_z/

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux