usage of reference
<pre><code>void fn(string &amp;s)
{
    //....
}

//use the function    
fn("helloworld");
</code></pre>

<p>Firstly, it's wrong to initiate a non-const string with a const char string.</p>

<p>After I add const in the parameter, it compiles.</p>

<p>But is it right to reference a temporary object string("helloworld") on stack?</p>

<p>Is it sure that string("helloworld") gets called?</p>

<p>--</p>

<p>edits.</p>

<p>If a temporary string is created, how the compiler judges that the object string("helloworld") is const from the constructor of std::string(const char*)?</p>
