title: Difference between pointer-to-pointer vs reference-to-pointer (C++)
body: <p>I have a bit of COM code that uses interface pointers. The original author of the code implemented functions that return an interface pointer like this:</p>
  
  <pre><code>HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject* &amp;pEnumerator ); // (1)
  </code></pre>
  
  <p>instead of the traditional</p>
  
  <pre><code>HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject** ppEnumerator ); // (2)
  </code></pre>
  
  <p>The function (1) is called like this:</p>
  
  <pre><code>hRes = Query ( sQuery, pEnumerator ); // (3)
  </code></pre>
  
  <p>which definitely <em>looks</em> wrong but it works fine. I'm not sure if I'm just picking up this line because the out parameter is not a pointer to the output variable or because there's something wrong with this approach.</p>
  
  <p>Is there an advantage to using a reference-to-pointer instead of a pointer-to-pointer for out parameters?</p>