Bilješka
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati da se prijavite ili promijenite direktorije.
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati promijeniti direktorije.
VARIANT 'var' was cleared when it was uninitialized (expression 'expr')
Remarks
This warning is triggered when an uninitialized VARIANT is passed to an API, such as VariantClear, that clears the object. Initialize the VARIANT before passing it to these functions so it can be properly cleared.
This warning applies to these functions:
VariantClearPropVariantClearVariantCopyVariantCopyIndVariantChangeTypeVariantChangeTypeExDestroyPropVariant
Code analysis name: VARIANTCLEAR_UNINITIALIZED
Example
The following code causes warning C33001:
#include <Windows.h>
HRESULT foo(bool some_condition)
{
VARIANT var;
if (some_condition)
{
//...
VariantInit(&var);
//...
}
VariantClear(&var); // C33001
}
In this example, the warning is corrected by calling VariantClear only after var has been initialized:
#include <Windows.h>
HRESULT foo(bool some_condition)
{
VARIANT var;
if (some_condition)
{
//...
VariantInit(&var);
//...
VariantClear(&var); // OK
}
}