c++ - Usage of uintptr_t vs DWORD_PTR -
both used storing addresses , doing pointer arithmetic, both defined in winapi, when should use uintptr_t
(cstdint) vs dword_ptr
(windows.h)? both 32bits , 64bits in x86 , x86_64 respectively
a
dword_ptr
unsigned long
type used pointer precision. used when casting pointerunsigned long
type perform pointer arithmetic.dword_ptr
commonly used general 32-bit parameters have been extended 64 bits in 64-bit windows.
i not intend code portable, i'm stuck winapi. type best use case?
prefer uintptr_t
part of c++ standard of c++11 , later. dword_ptr specific visual c++ , therefore not portable.
while visual c++ may choose implement uintptr_t
dword_ptr
or unsigned long
under hood, them do, safer sticking standard library.
Comments
Post a Comment