I am looking at some inherited C ++ code associated with the Windows Imaging Component library of components, and I noticed the following:
void setProperties(IPropertyBag2* const pBag)
{
pBag->Write(...);
}
void other_function()
{
CComPtr<IPropertyBag2> pBag;
setProperties(pBag);
}
The method setPropertiessimply writes a bunch of properties to the property package. The code compiles and works fine, because I think it calls the appropriate machine translation operator.
My question is whether such an interface is recommended or is there a better way to pass a pointer. For example, is there any difference (in terms of security / performance) if the signature has been changed to:
void setProperties(const CComPtr<IPropertyBag2>& pBag)
source
share