Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
>
>
>
V580. Suspicious explicit type...
menu mobile close menu
Additional information
toggle menu Contents

V580. Suspicious explicit type casting. Consider inspecting the expression.

21 Jul 2011

The analyzer detected an odd explicit type conversion. It may be either an error or a potential error.

Consider this sample:

DWORD errCode = 0;
void* dwErrParams[MAX_MESSAGE_PARAMS];
dwErrParams[0] = *((void**)&errCode);

The code contains a 64-bit error. The 'DWORD' type is cast to 'void *' type. This code works incorrectly in 64-bit systems where the pointer's size does not coincide with the size of the DWORD type. This is the correct code:

DWORD_PTR errCode = 0;
void* dwErrParams[MAX_MESSAGE_PARAMS];
dwErrParams[0] = (void *)errCode;

This diagnostic is classified as: