| title |
c33022 |
| description |
C33022 warning for HRESULTs |
| keywords |
c33022 |
| author |
hwisungi |
| ms.author |
hwisungi |
| ms.date |
06/20/2020 |
| ms.topic |
reference |
| f1_keywords |
|
| helpviewer_keywords |
|
| dev_langs |
|
Warning C33022: Potentially incorrect HRESULT usage detected (low confidence)
This is low-confidence warning for a function that returns HRESULT, if there is "FALSE"
somewhere along the line that eventually returns it or assigns it to a variable that is returned.
#include <Windows.h>
#define CHECK_RESULT(X) X ? S_OK : FALSE;
#define RETURN_RESULT(X) return CHECK_RESULT(X)
HRESULT foo()
{
// ......
RETURN_RESULT(FALSE); // C33022
}
These warnings are corrected by using proper HRESULT value:
#include <Windows.h>
#define CHECK_RESULT(X) X ? S_OK : E_FAIL;
#define RETURN_RESULT(X) return CHECK_RESULT(X)
HRESULT foo()
{
// ......
RETURN_RESULT(FALSE); // OK
}
C33020