Why max (max(a,b), c) is error
<p>Reference: code snippet from C++ Template: The Complete Guide</p>

<pre><code>// maximum of two values of any type (call-by-reference) 
template &lt;typename T&gt; 
inline T const&amp; max (T const&amp; a, T const&amp; b) 
{ 
    return a &lt; b ? b : a; 
} 

// maximum of two C-strings (call-by-value) 
inline char const* max (char const* a, char const* b) 
{ 
    return std::strcmp(a,b) &lt; 0 ? b : a; 
} 

// maximum of three values of any type (call-by-reference) 
template &lt;typename T&gt; 
inline T const&amp; max (T const&amp; a, T const&amp; b, T const&amp; c) 
{ 
    return max (max(a,b), c); // error, if max(a,b) uses call-by-value 
} 

int main () 
{ 
    ::max(7, 42, 68); // OK 

    const char* s1 = "frederic"; 
    const char* s2 = "anica"; 
    const char* s3 = "lucas"; 
    ::max(s1, s2, s3); // ERROR 

} 
</code></pre>

<p>Stated issues for above code:</p>

<blockquote>
  <p>The problem is that if you call max() for three C-strings, the
  statement</p>
  
  <p>return max (max(a,b), c);  becomes an error. This is because for
  C-strings, max(a,b) creates a new, temporary local value that may be
  returned by the function by reference.</p>
</blockquote>

<p>Question> I still don't understand the points above. Why </p>

<blockquote>
  <p>"you can't use the three-argument version to compute the maximum of
  three C-strings"?</p>
</blockquote>

<p>// Update </p>

<pre><code>const int* fReturnValue(const int *i)
{
    return i;
}

int main()
{
    int i = 3;
    const int* i4= fReturnValue(&amp;i);

    cout &lt;&lt; &amp;i &lt;&lt; endl;
    cout &lt;&lt; i4 &lt;&lt; endl;
}
</code></pre>

<p>Observation: both lines return the same address.
So I assume that in function fReturnValue, the function returns by value but it doesn't hurt b/c it is a pointer address. In other words, the return address is still valid.</p>

<p>Is that true?</p>
