int与long区别
来源:互联网 发布:ipv4 6无网络访问权限 编辑:程序博客网 时间:2024/04/29 17:11
数据模型决定了C语言中基本数据类型与数据宽度的对应关系。我们常用的32位模型称为ILP32,而64位模型有三种:LP64、LLP64和ILP64。在64位模型中,指针一定是64位的,但是int和long的宽度则在不同的数据类型中有不同的定义。如下表:
datatype
LP32
ILP32
LLP64
LP64
ILP64
char
8
8
8
8
8
short
16
16
16
16
16
int
16
32
32
32
64
long
32
32
32
64
64
long long
64
64
64
64
64
pointer
32
32
64
64
64
从前的DOS是应该是LP32;现在的Windows 32和Linux 32是ILP32;在即将流行的64bits世界,Windows x64 版采用的是LLP64模型,Linux64采用的是LP64模型,用gcc编译时可以指定-m32按照ILP32模型进行编译。
指针大小跟机器字长相关。为了兼容,在写C代码时,用int声明32bit整数,用long long声明64bit整数。
按照POSIX的规定,一个整型的正确格式化串为:
sign
char
short
int
long
long long
signed
%hhd
%hd
%d
%ld
%lld
unsigned
%hhu
%hu
%u
%lu
%llu
转:http://blog.csdn.net/chinesejimmy/article/details/1627214
- int与long区别
- int与long区别
- int与long区别
- long long 与int的区别
- long long 与int的区别
- int, long, long long区别
- int 与 long 、long long
- C语言中int与long int的区别
- int,long,long long的区别
- int、long和long long的区别
- 关于int、short int、long int、long long 的区别
- int和long区别
- __int64 与 long long int
- __int64 与long long int
- __int64 与long long int
- iOS NSInteger/NSUInteger与int/unsigned int、long/unsigned long之间的区别!
- iOS NSInteger/NSUInteger与int/unsigned int、long/unsigned long之间的区别!
- iOS NSInteger/NSUInteger与int/unsigned int、long/unsigned long之间的区别!
- 金典语录
- Tomcat源码学习
- Android应用的自动升级、更新模块的实现
- UTF-8 GBK UTF8 GB2312之间的区别和关系
- memcached工作原理与优化建议
- int与long区别
- android给Button或TextView等设置字体
- Nagios warning
- flex画虚线
- Visual C++ 64 位迁移的常见问题 .
- 提高PHP代码质量36计
- 【Android进阶】天天动听 悬浮歌词(迷你歌词)效果解读
- PowerDesigner 常用设置
- 【cocos2d-x】cocos2d-x 2.0.1 使用的一些心得