4 ms·
once again, how do the headers conjure up the int64_t type? it's not a keyword.
by tedunangst 13y ago
once again, how do the headers conjure up the int64_t type? it's not a keyword.
- cmccabe 13y agoHere is how stdint.h on Linux conjures up the int64_t type. #if __WORDSIZE == 64 typedef long int int64_t; #else typedef long long int int64_t; #endif
- tedunangst 13y agoWait. You just typed long long. You're not allowed to do that.
- Peaker 13y agoYou're whooshing. You don't want to use "long long" because that's not necessarily 64-bits. You want to use int64_t which guarantees it is 64-bits. And then, the correct format specifier for that is PRIi64, and not "%ld" or "%lld" which will break in different platforms.
- cmccabe 13y agoPlease don't be disingenuous. We both know that using #defines, you can get a type which is exactly 64 bits on any modern architecture. The fact that long long and long int are a builtin types and int64_t is implemented in terms of them, rather than the other way around, is just an implementation detail.