| title |
c33005 |
| description |
C33005 warning for VARIANTs |
| keywords |
c33005 |
| author |
hwisungi |
| ms.author |
hwisungi |
| ms.date |
06/20/2020 |
| ms.topic |
reference |
| f1_keywords |
|
| helpviewer_keywords |
|
| dev_langs |
|
Warning C33005: VARIANT 'var' was provided as an input or input/output parameter but was not initialized (expression 'expr')
This warning is triggered when an uninitialized VARIANT is passed to a function as input-only or input/output
parameter - for example, a pass-by-refrence parameter without an _Out_ SAL annotation.
#include <Windows.h>
void bar(VARIANT* v); // v is assumed to be input/output
void foo()
{
VARIANT v;
bar(&v); // C33005
// ......
VariantClear(&v); // OK, assumed to be initialized by bar
}
These warnings are corrected by ensuring to initialize the VARIANT before passing it to a function
as input-only or input/output.
#include <Windows.h>
void bar(VARIANT* v); // v is assumed to be input/output
void foo()
{
VARIANT v;
VariantInit(&v);
bar(&v); // OK
// ......
VariantClear(&v); // OK, assumed to be initialized by bar
}
C33001
C33004