Question

According to Windows Data Type, both DWORD and DWORD32 are "A 32-bit unsigned integer" except IntSafe.h and the other is defined in BaseTsd.h. What's the difference or maybe advantage in using one over the other?

Was it helpful?

Solution

Windows APIs are full of decades of C #define and typedef debris.

What you are looking at is some of that debris. Maybe at some point they thought about having a DWORD that scaled in size, while DWORD32 would not.

But that hope is long dead. They are almost certainly identical types, and almost certainly will never become non-identical.

If you where using something called DWORD16 and DWORD64 for whatever reason, the name DWORD32 would fit in, or if you for some other reason really want to stress the number of bits in your DWORD32 type, that type might be a better idea. Otherwise, pick one, use it, and ignore the other.

OTHER TIPS

They are identical. DWORD is maintained for backwards compatibility with decades of legacy code, and is always 32-bit. DWORD32 is the same data type and merely explicitly indicates that it is 32-bit. DWORD32 was introduced at the same time as DWORD64 and DWORD_PTR were introduced, when the API was being updated to support 64-bit development.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top