How large is a DWORD with 32- and 64-bit code?

2019-01-08 14:47发布

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?

7条回答
Lonely孤独者°
2楼-- · 2019-01-08 15:10

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

查看更多
\"骚年 ilove
3楼-- · 2019-01-08 15:16

:) word on modern processors is either 32-bit or 64-bit. It's simply memory pointer's length (which is ALU's capacity in turn).

But historically x86 "word" is 16 bits (instead of 32). Thereby Microsoft libraries which historically target x86, define DWORD as unsigned long i.e. "machine pointer size".

That's all kids. For future reference see Wikipedia.

查看更多
▲ chillily
4楼-- · 2019-01-08 15:16

Call a long, dword32, dword64... whatever you want, but a byte is 8 bits a word is 2 bytes a dword (double word) is 2 words a qword (quad word) is 4 words

On 32 or 64bit systems the aliases like LONG or INT may vary, but a dword is still a double word

查看更多
爷的心禁止访问
5楼-- · 2019-01-08 15:20

8 bits is a byte. 2 bytes is a word. Double word or DWORD is 4 bytes or 2 words.

查看更多
不美不萌又怎样
6楼-- · 2019-01-08 15:22

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

查看更多
等我变得足够好
7楼-- · 2019-01-08 15:25

DWord is a Double word and a word is 65535. Double Word would then be 65535^2 = 4294836225 or ulong and its 4 bytes in size word is 2 byte

And this is 2 bytes to store on harddrive or send over the internet.

查看更多
登录 后发表回答