int是有符号的,而DWORD是无符号的
typedef unsigned long DWORD;
DWORD 32位 不是c++类型,它定义在windows.h中
int会随着机器位数的不同而发生变化,比如在16位机上为16为,在32位机上为32位,在64位机上为64位
建议在DWORD的地方尽量使用DWORD.
int 与 long的区别在这儿:[url=http://stackoverflow.com/questions/271076/what-is-the-difference-between-an-int-and-a-long-in-c/271132#271132]http://stackoverflow.com/questions/271076/what-is-the-difference-between-an-int-and-a-long-in-c/271132#271132[/url]
在win7 64, VS 2005中,上面输出12444
typedef unsigned long DWORD;
DWORD 32位 不是c++类型,它定义在windows.h中
int会随着机器位数的不同而发生变化,比如在16位机上为16为,在32位机上为32位,在64位机上为64位
建议在DWORD的地方尽量使用DWORD.
int 与 long的区别在这儿:[url=http://stackoverflow.com/questions/271076/what-is-the-difference-between-an-int-and-a-long-in-c/271132#271132]http://stackoverflow.com/questions/271076/what-is-the-difference-between-an-int-and-a-long-in-c/271132#271132[/url]
printf("%d", sizeof(char));
printf("%d", sizeof(short));
printf("%d", sizeof(int));
printf("%d", sizeof(DWORD));
printf("%d", sizeof(long));在win7 64, VS 2005中,上面输出12444
本文解释了int和DWORD在C++编程中的区别,特别是在Windows环境下。int是一个有符号整型,其大小随机器位数变化;而DWORD是一个无符号长整型,定义在windows.h中,固定为32位。此外,还提供了不同数据类型大小的实际示例。
1198

被折叠的 条评论
为什么被折叠?



