-1
我尝试以下方法句柄转换为void *,然后返回到处理以下方式转换uint64_t中为void *和背部
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
但是,如果我这样做,我能恢复hInt
:
uint64_t hIntBack = reinterpret_cast<uint64_t>(hPoint)
我不知道我明白这两种方法之间的区别。
'无效* H对准=的reinterpret_cast(HINT);'=>'无效* H对准=的reinterpret_cast (&hInt);' –
user0042
类似的问题到https://stackoverflow.com/questions/45657427/access-violation-casting-to-void-and-back –