C33005

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.

Example

#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
}

See also

C33001 C33004