具有 32 位和 64 位代码的 DWORD 有多大? [英] How large is a DWORD with 32- and 64-bit code?

查看:32
本文介绍了具有 32 位和 64 位代码的 DWORD 有多大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual C++ 中,DWORD 只是一个与机器、平台和 SDK 相关的无符号长整型.但是,既然 DWORD 是一个双字(即 2 * 16),那么在 64 位架构上,DWORD 仍然是 32 位吗?

解决方案

实际上,在 32 位计算机上,一个字是 32 位的,但 DWORD 类型是 16 位过去美好时光的遗留物.

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

您可以在此处找到官方列表:http://msdn.microsoft.com/en-us/图书馆/aa383751(VS.85).aspx

随着从 32 位到 64 位过渡而改变的所有平台相关类型都以 _PTR 结尾(DWORD_PTR 在 32 位 Windows 上为 32 位,在 64 位 Windows 上为 64 位).

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?

解决方案

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).

这篇关于具有 32 位和 64 位代码的 DWORD 有多大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆