invalid conversion from const char * to char * in Linux with Ternary Operator
<p>Example 1:</p>

<pre><code>char* message = ( m_message != NULL ? m_message : "" );
</code></pre>

<p>above line gives compiler error as invalid conversion from const char* to char*. in g++ compiler. but the below piece of code works.</p>

<p>Example 2:</p>

<pre><code>char* message;
if(m_message)
    message = m_message;
else
    message = "";
</code></pre>

<p>Why do I get a compiler error with <code>g++</code> in the first example but not the second? Both ways work fine in Windows. </p>