WinAPI 中定义的 DWORD 与程序集中定义的 DWORD 相同吗
在WinAPI中:
typedef unsigned long DWORD;
我认为DWORD、WORD...是计算机中的基本数据类型,无论int、unsigned long...最终在汇编中都会转换为DWORD,为什么这里要转换为unsigned long?不加定义就不能直接使用DWORD吗?
in WinAPI:
typedef unsigned long DWORD;
I think DWORD, WORD ... is the basic data type in computer, for no matter int, unsigned long... it will be converted to DWORD finally in assembly, why should it be converted to unsigned long here? Can't I use DWORD directly without the difinition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
DWORD 是它定义的任何内容(汇编中不会自动转换为特定宽度)。需要此 typedef,因为无论使用 DWORD,WinAPI 接口都是用无符号长整型定义的。 IOW,您需要此定义才能使用 API。
回答你的另一个问题。这个答案是否定的,没有定义就不能使用DWORD。它不是编译器的内置类型。
Win32 API 的 DWORD 定义是固定的: http:// /msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx
DWORD is whatever it is defined to be (there is no automatic translation to a specific width in assembly). This typedef is needed because the WinAPI interfaces are all defined with unsigned longs wherever DWORD is used. IOW, you need this definition in place to work with the API.
To answer your other question. This answer is no, DWORD can't be used without a definition. It isn't a built-in type for the compiler.
The definition of DWORD is fixed for the Win32 API: http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx