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

后端 未结 3 1135
终归单人心
终归单人心 2020-12-01 02:53

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

3条回答
  •  执笔经年
    2020-12-01 03:23

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

提交回复
热议问题