int、int_32t、int_64t

来源:互联网 发布:北京sql培训 编辑:程序博客网 时间:2024/06/08 14:02

转载自http://blog.sina.com.cn/s/blog_4b9eab320100sdex.html

32位平台:

char  1个字节8位

short  2个字节

int    4个字节

long   4个字节

long long   8个字节

float   4个字节

double    8个字节

指针    4个字节


64位平台:

char   1个字节

short   2个字节

int     4个字节

long 8个字节

long long   8个字节

float   4个字节

double   8个字节

指针  8个字节

因为long在不同的平台所占用的字节数不一样,为了保证平台的通用性,程序中尽量不要使用long数据库型。可以使用固定大小的数据类型宏定义:

typedef signed char int8_ttypedef short int   int16_t;typedef int  int32_t;# if __WORDSIZE == 64typedef long int  int64_t;# else__extension__typedef long long int  int64_t;#endif