C/C++
64비트 리눅스에서의 gcc 데이터 타이별 사이즈
눈사람
2010. 2. 24. 22:23
( signed | unsigned ) char : 1byte
( unsigned ) short : 2byte
( unsigned ) int : 4byte
( unsigned ) long : 8 byte
float : 4byte
double : 8byte
long double : 16byte
주의사항: VC++ 64bit 버전에선 long 타입이 4byte.
( unsigned ) short : 2byte
( unsigned ) int : 4byte
( unsigned ) long : 8 byte
float : 4byte
double : 8byte
long double : 16byte
주의사항: VC++ 64bit 버전에선 long 타입이 4byte.
참고로 integer의 사이즈 때문에 고민스러울 떄는 그냥
- #include <stdint.h>
를 해주자.
int32_t 타입등에 대해서 궁금할 때는
http://linux.die.net/man/3/int32_t
아랫 부분의 위의 URL에서 발췌.
Exact-width integer types
- Integer types having exactly the specified width
- typedef signed char int8_t
- typedef unsigned char uint8_t
- typedef signed int int16_t
- typedef unsigned int uint16_t
- typedef signed long int int32_t
- typedef unsigned long int uint32_t
- typedef signed long long int int64_t
- typedef unsigned long long int uint64_t
Integer types capable of holding object pointers
- These allow you to declare variables of the same size as a pointer.
- typedef int16_t intptr_t
- typedef uint16_t uintptr_t
Minimum-width integer types
- Integer types having at least the specified width
- typedef int8_t int_least8_t
- typedef uint8_t uint_least8_t
- typedef int16_t int_least16_t
- typedef uint16_t uint_least16_t
- typedef int32_t int_least32_t
- typedef uint32_t uint_least32_t
- typedef int64_t int_least64_t
- typedef uint64_t uint_least64_t