You're writing some code that uses COM. Do you use SmartPointers or not use SmartPointers? Debate on this topic flares up now and then.
The trick to answering it is to seperate the technical facts from stubbornly held beliefs. Like any technology, there is a right time and a wrong time to use it. But that's not what I want to talk about today. Let's assume you've decided to use SmartPointers. I posit that CComPtr<> is good and CComQIPtr<> is bad.
The reason for this is simple: CComQIPtr<> masks the return value of the QueryInterface() call.
Lets take a look at two snippets of code to frame the discussion:
Some points:
In summary: use CComPtr<> and don't use CComQIPtr<>. I would especially encourage those who would write Internet Explorer extensions to use CComPtr<>.
Thoughts?