When using the Windows API, I usually use the types specified by the functions like DWORD... even though I think those typedefs are kind of stupid.
It has a few advantages, such as:
- Easier to match the types passed with the parameter types in MSDN, rather than mentally converting all the Windows types into primative types.
- It makes it look more consistent.
- If Microsoft ever lost their minds and decided to change the typedefs to something else (DWORD = unsigned long long instead of unsigned int, for example), then you don't have to worry about changing all the types you use in your code.
You mean, like WPARAM, LPARAM and LRESULT are 64 bits in 64-bit systems? And WPARAM was just 16 bits in 16-bit systems?
Or you can go the other way round - what happens if you use a long in the 32-bit system and then try to compile it with a 64-bit MinGW GCC?
There's a reason for these typedefs - most of them, anyway. INT, LONG and its friends are just stupid.
I do use them, but I don't use LPCSTR and the like. Especially pointer typedefs are stupid.
Originally Posted by cpjust
The rest I have no quarrels about. I tend to match type simply for the reason you specify.