Do you find references invisible when you scan code, and are there any coding guidelines for their usage?
<p>I have developed a habit of using safe C++ constructs where possible, but there is one place where I'm always not sure if it's better to use references or resort to good ol' pointers.</p>

<p>Example code:</p>

<pre><code>int FillFancyPointer(char *&amp;ptr)
{
    ptr = NULL;

    char *tmp_ptr = static_cast&lt;char*&gt;(calloc(...));
    if(!ptr)
        return -1;

   ptr = tmp_ptr;
   return 0;
}
</code></pre>

<p>Later in code:</p>

<pre><code>char *ptr = nullptr;
if(FillFancyPointer(ptr)&gt;=0 &amp;&amp; ptr)
   Nice();
</code></pre>

<p>The problem with this, IMHO, is that the ptr appears to be read only variable when looking at the code, while in reality it is modified.</p>

<p>The COM approach <code>ISmthn *ptr;</code>, <code>CoCreate(..., &amp;ptr)</code> seems more pronounced. But it's also more error prone, as there is this <code>**</code> stuff everywhere.</p>

<p>Come to think of it, output variables like <code>std::string</code> will also be masked with such approach.</p>

<p><code>int Foo(const string &amp;in, string &amp;inout)</code></p>

<p>Do you find references confusing in such places?</p>
