Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
VARIANT 'var' was provided as an
_In_or_InOut_parameter but was not initialized (expression 'expr')
Remarks
This warning is triggered when an uninitialized VARIANT is passed to a function as an input-only or input/output parameter. For example, a pass-by-reference parameter without an _Out_ SAL annotation.
Code analysis name: VARIANTCLEAR_UNINITFUNCPARAM
Example
The following sample code causes warning C33005:
#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
}
To correct these warnings, 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
}