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 pointer unsigned 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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -