64位编程开发-数据类型

3421阅读 0评论2011-07-20 RealAMD
分类:

1.32位程序的数据模型
主要有两种ILP32和LP32。ILP32即表示整型、long、指针都是32位;LP32表示long和指针是32位。

2.64位程序的数据模型
主要有:LP64、ILP64、LLP64三种。

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


绝大部分64位的Unix,linux都是使用的LP64模型;
64位的Windows使用的是LLP64(long long and point 64)模型。

float    都是4字节;
double    都是8字节;(C中直接写小数,默认是double型)

想要得到一定的代码可移植性,提高维护性:
打印无符号整形数,不管申明时是如何定义的,统一使用 %lu
 
参考文献:
Data Size Neutrality and 64-bit Support
 
64-Bit Programming Models: Why LP64?
上一篇:交互式的rpm
下一篇:常用cmd命令