I have COM code that uses interface pointers. The original author of the code implemented functions that return an interface pointer as follows:
HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject* &pEnumerator );
instead of traditional
HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject** ppEnumerator );
Function (1) is called like this:
hRes = Query ( sQuery, pEnumerator ); // (3)
which definitely looks wrong, but it works great. I am not sure if I am simply collecting this line because the out parameter is not a pointer to the output variable or because there is something wrong with this approach.
Is there any advantage to using a pointer-pointer instead of a pointer to a pointer for parameters?
source share