Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning C6387 Visual Studio

What is Visual Studio trying to tell me with this warning?

Warning

According to the docs, this warning is when you're passing a potentially null value to a parameter.

But I'm checking for null with if (hwnd) before calling these functions.

if (hwnd) {
    GetClientRect(hwnd, (LPRECT)&rMyRect);
    ClientToScreen(hwnd, (LPPOINT)&rMyRect.left);
    ClientToScreen(hwnd, (LPPOINT)&rMyRect.right);
}

1 Answers

The fact that you test for it is not relevant, the compiler isn't detecting that test. You can, however, use:

#pragma warning(suppress : 6387)

on the prior line and that will prevent the message (or use __Pragma(warning(suppress : 6387)) but I prefer the #pragma form.

like image 120
SoronelHaetir Avatar answered Oct 21 '25 01:10

SoronelHaetir