title: What are your best practices for C++ exception handling?
body: <p>I searched the Internet and found a lot of articles about this topic. However, I found there is no complete checklist to verify our code's quality of exception-safety.</p>
  
  <p>So, I want to collect valuable best practices for C++ exception handling from you.</p>
  
  <p>I first list some practices of my own:</p>
  
  <ol>
  <li><p>Catch all exceptions if any in destructors:</p>
  
  <pre><code>struct A
  {
      ~A()
      {
          try
          {
              // Here may throw exceptions
          }
          catch (std::runtime_error&amp; e)
          {}
          catch (...)
          {
              logging("...");
          }
      }
  };
  </code></pre></li>
  <li><p>Add function name, source file name and line numer in exception information. <code>__func__</code>, <code>__FILE__</code> and <code>__LINE__</code> are good friends.</p></li>
  <li><p>Never use exception specifications. The reason is given in the book "C++ Coding Standards".</p></li>
  </ol>
  
  <p>What are yours?</p>