在a specific problem後面,自我回答並對其發表評論,我想了解它是否是一個正確的解決方案,解決方法/破解或者純粹是錯誤的。 具體而言,我重寫代碼: T x = ...;
if (*reinterpret_cast <int*> (&x) == 0)
...
如: T x = ...;
if (*reinterpret_cast <volatile int*> (&x
我有一個函數,需要一個無符號長整數*,並且需要將它傳遞給一個外部函數庫,該函數需要一個無符號整數*,並且在這個平臺上,unsigned int/long的大小相同。 void UpdateVar(unsigned long* var) {
// this function will change the value at the address of var
ExternalL