Sign in to follow this  
Uphoreum

Windows Data Type Macros

Recommended Posts

Uphoreum    216
Is there any reason to use the macros instead of the actual data type names? For example: DWORD or ULONG instead of unsigned long? Do the values of these macros change if you move to a 64-bit system or something? Or are they simply just for being shorter (if that was the case, why would the FLOAT and INT macros exist?)

Share this post


Link to post
Share on other sites
Colin Jeanne    1114
Some types will not change between 32-bit and 64-bit, for example, DWORD and ULONG. In fact, these types are pretty much guaranteed to never change. Types based on pointers, such as WPARAM, LPARAM, LP*, P*, or *_PTR will change in size from 32-bit to 64-bits.

That said, I prefer to use the Win32 type macros for visual consistency with the other types. Types like DWORD_PTR become much easier to understand if you're also using DWORDs.

Share this post


Link to post
Share on other sites
Uphoreum    216
I found this page which seems to explain it pretty well. Basically, it looks like BYTE, WORD, DWORD, and QWORD are architecture independent while LONG, CHAR, etc. are not.

Thanks, I was also wondering if people use it for the visual consistency, so that answers that question too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this