32 位和 64 位代码的 DWORD 有多大?

发布于 2024-07-04 05:39:23 字数 112 浏览 7 评论 0原文

在 Visual C++ 中,DWORD 只是一个与机器、平台和 SDK 相关的无符号长整数。 但是,由于 DWORD 是双字(即 2 * 16),因此在 64 位体系结构上 DWORD 仍然是 32 位吗?

In Visual C++ a DWORD is just an unsigned long that is machine, platform, and SDK dependent. However, since DWORD is a double word (that is 2 * 16), is a DWORD still 32-bit on 64-bit architectures?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

無處可尋 2024-07-11 05:39:24

否...在所有 Windows 平台上 DWORD 都是 32 位。 LONGLONG 或 LONG64 用于 64 位类型。

No ... on all Windows platforms DWORD is 32 bits. LONGLONG or LONG64 is used for 64 bit types.

不知所踪 2024-07-11 05:39:24

它的定义是:

typedef unsigned long       DWORD;

但是,根据 MSDN:

在 32 位平台上,long 为
与 int 同义。

因此,DWORD 在 32 位操作系统上是 32 位的。 64 位 DWORD 有一个单独的定义:

typdef unsigned _int64 DWORD64;

希望有帮助。

It is defined as:

typedef unsigned long       DWORD;

However, according to the MSDN:

On 32-bit platforms, long is
synonymous with int.

Therefore, DWORD is 32bit on a 32bit operating system. There is a separate define for a 64bit DWORD:

typdef unsigned _int64 DWORD64;

Hope that helps.

清晰传感 2024-07-11 05:39:24

实际上,在 32 位计算机上,一个字是 32 位的,但 DWORD 类型是 16 位旧时代的遗留物。

为了更容易地将程序移植到较新的系统,微软决定所有旧类型都不会改变大小。

您可以在这里找到官方列表:
http://msdn.microsoft.com/en-us/ Library/aa383751(VS.85).aspx

随着从 32 位到 64 位的转换而更改的所有与平台相关的类型均以 _PTR 结尾(DWORD_PTR 在 32 位 Windows 上为 32 位,在 64 位 Windows 上为 32 位) -位(在 64 位 Windows 上)。

Actually, on 32-bit computers a word is 32-bit, but the DWORD type is a leftover from the good old days of 16-bit.

In order to make it easier to port programs to the newer system, Microsoft has decided all the old types will not change size.

You can find the official list here:
http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx

All the platform-dependent types that changed with the transition from 32-bit to 64-bit end with _PTR (DWORD_PTR will be 32-bit on 32-bit Windows and 64-bit on 64-bit Windows).

独守阴晴ぅ圆缺 2024-07-11 05:39:24

Windows API 定义 DWORD 大小如下:

  • x86: sizeof(DWORD) = 4
  • x64: sizeof(DWORD) = 4强>

Windows API defines DWORD sizes as follows:

  • x86: sizeof(DWORD) = 4
  • x64: sizeof(DWORD) = 4
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文