现在的位置: 首页 > 综合 > 正文

long 和 int

2013年03月15日 ⁄ 综合 ⁄ 共 318字 ⁄ 字号 评论关闭
程序移植注意:
16位系统:long是4字节,int是2字节
32位系统:long是4字节,int是4字节
64位系统:long是8字节,int是4字节

# if __WORDSIZE == 64
typedef long int  int64_t;
# else
__extension__
typedef long long int  int64_t;
# endif

uint64_t用来表示64位整数,在32位系统中是unsigned long long int,在64位系统中是unsigned long int,所以打印uint64_t的格式化方法是:

printf("%lu", value); // 64bit OS
printf("%llu, value); // 32bit OS

抱歉!评论已关闭.