-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 –