I am trying the following approach to convert a handle to void* and then back to the handle the following way
uint64_t hInt = 154071804376; //assume this is a valid memory location
void* hPoint = reinterpret_cast<void*>(hInt);
uint64_t hIntBack = *static_cast<uint64_t*>(hPoint); unable to recover hInt here, getting some other number 140727986249696
However, if I do this, I am able to recover the hInt
:
uint64_t hIntBack = reinterpret_cast<uint64_t>(hPoint)
I am not sure I understand the difference between the two approaches.