This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: int64_t == long long


John Love-Jensen wrote:
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;

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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]