Tell me more ×  The MSDN article just says:  Return Value  S_OK
on success, or any standard HRESULT error value.  However, my
guess is that E_OUTOFMEMORY is the only feasible error return
since NULL is valid input and an invalid memory location will
just throw an access violation (hopefully).  So. Are there any
other possible HRESULTS from this method?  Note: The following
all return S_OK:  CComBSTR bstr;
bstr.AssignBSTR(SysAllocString(L""));   //clearly a leak,
abbreviated example...  Bottom Line: Is the following good
practice (and why do I often see other implementations?):  class
foo {   STDMETHOD(put_Bar)(BSTR p);   CComBSTR m_bstrBar
STDMETHODIMP foo::put_Bar( BSTR p)     return
m_bstrBar.AssignBSTR(p); share|improve this question add comment
1 Answer  up vote 2 down vote accepted  Yes, E_OUTOFMEMORY is it
in this very specific case. You can see the source code in
vc/atlmfc/include/atlcomcli.h  This is otherwise similar to
asking for exception specifications. Doesn't work, COM methods
can return any e