共用方式為


警告 C26471

請勿使用 reinterpret_cast。 來自 void* 的轉換可以使用 static_cast (type.1)

備註

程式碼分析名稱:NO_REINTERPRET_CAST_FROM_VOID_PTR

範例

void function(void* pValue)
{
    {
        int* pointerToInt = reinterpret_cast<int*>(pValue); // C26471, use static_cast instead
    }
    {
        int* pointerToInt = static_cast<int*>(pValue); // Good
    }
}

另請參閱

C++核心指導方針類型.1