Udostępnij za pośrednictwem


Ostrzeżenie C26471

Nie używaj reinterpret_cast. Rzutowanie z void* może być używane static_cast (typ.1)

Uwagi

Nazwa analizy kodu: NO_REINTERPRET_CAST_FROM_VOID_PTR

Przykład

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

Zobacz też

C++ Core Guidelines Type.1