I came across what looks like a breaking change in CComVariant
but I can't find any mention of this on the interwebs.
Up to visual studio 2008 passing a NULL
SAFEARRAY
pointer to CComVariant
would result in an empty variant (VT_EMPTY
), the constructor looked like this:
CComVariant(__in_opt const SAFEARRAY *pSrc)
{
LPSAFEARRAY pCopy;
if (pSrc != NULL)
{ // ...
Starting with visual studio 2010 passing a nullptr
SAFEARRAY
to CComVariant
throws an exception by default. If _ATL_NO_VARIANT_THROW
is defined it leaves the CComVariant
in error state (VT_ERROR
). The constructor starts like this:
CComVariant(_In_ const SAFEARRAY *pSrc) ATLVARIANT_THROW()
{
ATLASSERT(pSrc != NULL);
Is there any documentation of the parameter changing from in-opt to in? Why did Microsoft decide to make such a breaking change? It's very untypical of them to do so.