Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1915660
  • 博文数量: 261
  • 博客积分: 8073
  • 博客等级: 中将
  • 技术积分: 2363
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-10 15:23
文章分类

全部博文(261)

文章存档

2013年(1)

2012年(1)

2011年(50)

2010年(34)

2009年(4)

2008年(17)

2007年(55)

2006年(99)

分类:

2011-07-20 16:33:35

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?
阅读(3260) | 评论(0) | 转发(0) |
0

上一篇:交互式的rpm

下一篇:常用cmd命令

给主人留下些什么吧!~~