본문 바로가기

64비트 컴퓨팅

32-bit and 64-bit data models

ILP32 LP64 LLP64 ILP64
char 8 8 8 8
short 16 16 16 16
int 32 32 32 64
long 32 64 32 64
long long 64 64 64 64
size_t 32 64 64 64
pointer 32 64 64 64


x64 는 LLP64, LINUX는 LP64 모델임.

Type name Type size (32-bit system) Type size (64-bit system) Description
ptrdiff_t 32 64 Signed integer type that appears after the subtraction of two pointers. It is used to keep sizes. Sometimes it is used as the result of a function returning the size or -1 if an error occurs.
size_t 32 64 Unsigned integer type. The result of the sizeof() operator. It is used to keep the size or count of objects.

intptr_t, uintptr_t, SIZE_T, SSIZE_T, INT_PTR, DWORD_PTR, etc

32 64 Integer types able to keep the pointer value.
time_t 32 64 Time in seconds.


Expression Result (Dec) Result (Hex)
ptrdiff_t Result; Result = 1 << 31; -2147483648 0xffffffff80000000
Result = ptrdiff_t(1) << 31; 2147483648 0x0000000080000000
Result = 1U << 31; 2147483648 0x0000000080000000
Result = 1 << 32; 0 0x0000000000000000
Result = ptrdiff_t(1) << 32; 4294967296 0x0000000100000000