title: try{ } catch(...) { } in C callback - bad idea?
body: <p>I'm implementing callbacks in C++ which will be called from ordinary C code. My main() function is C++ already, but C code will be responsible for creating threads that will eventually call my callbacks.</p>
  
  <p>Right now my callbacks look like</p>
  
  <pre><code>int handle_foo(void *userdata) {
      try {
          MyCPPClass *obj = static_cast&lt;MyCPPClass *&gt;(userdata);
          obj-&gt;doStuff();
          return 0; // no error
      } catch(...) {
          LogError("doStuff failed"); 
          return -1; // error
      }
  }
  </code></pre>
  
  <p>This works OK, but it seems weird to me. Furthermore, I lose some useful features such as the ability to find out <em>what</em> was thrown (without adding huge amounts of extra <code>catch</code> statements to each and every one of my callbacks).</p>
  
  <p>Is <code>try {} catch(...) {}</code> here reasonable, or is there a better way to write my C callbacks?</p>