LONG和DWORD
来源:互联网 发布:游奇网络有多少人 编辑:程序博客网 时间:2024/06/06 02:28
今天看BITMAP的数据结构说明,发现了DWORD和LONG,还以为LONG要更大一些,原来,对于32位的机子,二者都是32位的,4个字节,只不过LONG有一位被用来做符号位。
typedef long LONG;
typedef unsigned long DWORD;
据说 数据位数和编译器有关。
参看 http://msdn.microsoft.com/en-us/library/aa383751(v=vs.85).aspx
DWORD 是 无符号的2个字。
A 32-bit unsigned integer. The range is 0 through 4294967295 decimal.(2的32次方 减去 1)
This type is declared in WinDef.h as follows:
typedef unsigned long DWORD;
LONG是 有符号的2个字。
A 32-bit signed integer. The range is –2147483648 through 2147483647 decimal.(2的31次方减去1)
This type is declared in WinNT.h as follows:
typedef long LONG;
MFC中的 无符短整型 : WORD 是无符号的。
A 16-bit unsigned integer. The range is 0 through 65535 decimal.
This type is declared in WinDef.h as follows:
typedef unsigned short WORD;
INT
A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal.
This type is declared in WinDef.h as follows:
typedef int INT;
我惊讶的发现
很多文章,说int 是16位的http://www.cublog.cn/u2/78880/showart_1894080.html,我开始恍惚了。
经过测试:
root@ubuntu:/home/zhangbin/qt# ./testType
sizeof(int)=4
root@ubuntu:/home/zhangbin/qt#
我是AMD64上跑的32位系统。
http://tieba.baidu.com/p/1106664400
int 是一个字长。
short int 和int的区别在于,short int 是16位的 ,都是有符号的。
root@ubuntu:/home/zhangbin/qt# ./testType
sizeof(int)=4
sizeof(short int)=2
sizeof(long) = 4
WORD unsigned shot int
DWORD unsigned int
LONG long
INT int
感觉long就是long int ,就是int吧。
参考http://www.cppblog.com/lapcca/archive/2011/04/15/144302.html
- LONG和DWORD
- long和DWORD的一个压缩算法
- DWORD 和 LPCTSTR
- WORD和DWORD
- WORD 和DWORD
- DWORD和INT区别
- DWORD
- DWORD
- DWORD
- dword
- IP地址和DWORD转换
- 函数GetTickcount和DWORD关键字
- 关于float转DWORD和DWORD转float
- __int64和long long
- long long 和__int64
- long long和__in64
- char, unsigned char = BYTE; short, unsigned short = WORD; long, unsigned long = DWORD;
- 整形short、int、long和long long
- 盛意科技java面试
- 在Visual C++中怎样获取随机数
- 写一个函数,将其中的都转换成4个空格(四种方法)
- 通讯录小软件的制作
- nim 博弈
- LONG和DWORD
- A project with an Output Type of Class Library cannot be started directly
- DW RowsCopy注意事项
- AJAX 笔记3:无刷新评论【版本一(AJAX+JQuary+Rrepeater+SQL Server)】
- android基本组件01
- 系统架构师-基础到企业应用架构-系统建模[上篇]
- 解决eclipse停在启动界面不动
- 五个受用一生的心理寓言
- 系统架构师-基础到企业应用架构-系统建模[中篇](上)