0
uint8_t* buf1;
...
const signed char* buf2 = static_cast<const signed char*>(buf1);
invalid static_cast from type 'uint8_t* {aka unsigned char*}' to type 'const signed char*'錯誤:從「無符號字符*」無效轉換「常量符號字符*」
C風格的鑄造:(常量符號字符*)工作正常
有沒有用c任何危險-style-cast vs static_cast在這種情況下?
那麼,定義*「危險」*。它*是*合法的。 –
static_cast錯誤提示這不是安全操作,爲什麼static_cast失敗? –
,因爲你需要'reinterpret_cast' –