title: Should I use SEH "by default" in C?
body: <p>When I'm programming C code for Windows, should I "default" to using SEH's <code>__try</code>...<code>__finally</code> blocks, or is it considered bad practice to do so unnecessarily?</p>
  
  <p>In other words, which one below (for example) is considered better practice, and why?</p>
  
  <pre><code>HDC hDCCompat = CreateCompatibleDC(hDC);
  __try
  {
      HBITMAP hBmpCompat = CreateCompatibleBitmap(hDC, ...);
      __try
      {
          SelectObject(hDCCompat, hBmpCompat);
          BitBlt(hDC, ..., hDCCompat, ...);
      }
      __finally { DeleteObject(hBmpCompat); }
  }
  __finally { DeleteObject(hDCCompat); }
  </code></pre>
  
  <p>versus</p>
  
  <pre><code>HDC hDCCompat = CreateCompatibleDC(hDC);
  HBITMAP hBmpCompat = CreateCompatibleBitmap(hDC, ...);
  SelectObject(hDCCompat, hBmpCompat);
  BitBlt(hDC, ..., hDCCompat, ...);
  DeleteObject(hBmpCompat);
  DeleteObject(hDCCompat);
  </code></pre>
  
  <h3>Clarification</h3>
  
  <p>I forgot to mention:</p>
  
  <p>My idea behind this was that, if someone inserts more code later into the block (e.g. an early return from the function), my code would still perform the cleanup, rather than exiting prematurely. So it was supposed to be more preventive than anything else. Should I still avoid using SEH anyway?</p>