Bagikan melalui


Peringatan C26471

Jangan gunakan reinterpret_cast. Cast dari void* dapat menggunakan static_cast (type.1)

Keterangan

Nama analisis kode: NO_REINTERPRET_CAST_FROM_VOID_PTR

Contoh

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

Lihat juga

C++ Pedoman Inti Type.1