title: c++ exception parameter
body: <p>I have a question regarding the following code snippet I came across in one of our older libraries.</p>
  
  <pre><code>try
  {
    throw "this is an error message";
  }
  catch( char* error )
  {
    cout &lt;&lt; "an exception occured: " &lt;&lt; error &lt;&lt; endl;
  }
  </code></pre>
  
  <p>My understanding of the behavior in this case is, that the error message is thrown by value, which means a copy of the text </p>
  
  <blockquote>
    <p>"this is an error message"</p>
  </blockquote>
  
  <p>is thrown. The catch clause specifies a pointer to char as expected type of exception. Can some enlighten me, why this works? Another question in this context concerns the memory allocated for the error message. Since the exception type is pointer to char* one could assume, that the memory for the error message has been allocated dynamically on the heap and has to be deleted by the user?</p>
  
  <p>Thanks in advance</p>