What is the difference between DWORD and HANDLE type in C?
I have a thread with return type DWORD
in C but it is then handled by a HANDLE
type pointer.
What is the difference between these two types?
I am asking this question specially for ANSI C.
It is right that DWORD
is uint
type and HANDLE
is PVOID
, and C allows to cast directly DWORD
to HANDLE
. But is there any difference in these types or can I simply say they are the same?
It is a question that was asked 开发者_开发百科during a discussion. I want to know what the right answer is.
Win32:
- DWORD 32 bit unsigned long
- HANDLE void * (32 bit pointer)
Win64
- DWORD 32 bit unsigned long
- HANDLE void * (64 bit pointer)
DO NOT just assume you can cast one to the other. It will work for Win32 and break when you port it to Win64.
A HANDLE is a PVOID or a void* typedef, A DWORD is a uint32. Isn't a void* length depending from the memory architecture (eg. x86 & x64)?
精彩评论