>
>
>
V580. Suspicious explicit type casting.…


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

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: