Warning C33005
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
}
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for