64 位 Windows API:C/C++“DWORD"的大小是多少? [英] 64-bit Windows API: what is the size of a C/C++ "DWORD"?
问题描述
我只安装了 32 位 Windows,所以我无法自己验证.
I only have 32-bit Windows installed, so I cannot verify this myself.
如果我没理解错的话,Microsoft API 中各处使用的 DWORD 是参考了原来的 16 位字,与当前的硬件架构无关?
If I understand correctly, the DWORD used in various places in the Microsoft API is in reference to the original 16-bit word, and has nothing to do with the current hardware architecture?
因此,即使我最终编译并链接我的应用程序以在 64 位 Windows 中运行,看起来 32 位的 DWORD 仍将是 32 位吗?还是 DWORD 会变成 128 位宽?
So DWORD which seems to be 32 bits, will remain 32 bits even when I eventually compile and link my app to run in 64-bit Windows? Or will DWORD become 128 bits wide?
推荐答案
唯一能在 32 到 64 之间改变大小的是指针.所以 DWORD 保持 32 位宽.
The only thing that changes size between 32 and 64 are pointers. So DWORD stays 32 bits wide.
有些东西不是立即明显的指针,例如手柄、LPARAM、WPARAM.但是这三个在实际持有指针时会改变宽度.
Some things are not immediately obviously pointers, e.g. HANDLE, LPARAM, WPARAM. But these three change width as they actually hold pointers.
这篇关于64 位 Windows API:C/C++“DWORD"的大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!