title: How to do something useful with assert?
body: <p>I want to do something more useful with <code>assert</code> than just <code>abort</code>ing, that includes flushing some open files, and printing the stack trace.</p>
  
  <p>I read a few articles on assert such as <a href="http://www.drdobbs.com/assertions/184403861" rel="nofollow">Assertions by Andrei Alexandrescu</a> which talks about how to implement assertions. However I want to <em>replace the assert handler by my own even in third party libraries</em> which are used by my program. I understand most (but not all) compilers (gcc, MSVC, clang) &amp; libraries (Qt,boost) which I use has options to set user defined assert handler. However at present I am not interested to have <code>Abort,Retry,Ignore</code> feature for the assert, and so not looking to my code in compiler/library specific assert handler.</p>
  
  <p>As I understand, <code>assert</code> calls <code>abort</code> which sends <code>SIGABRT</code> signal, can I trap this signal and do the useful tasks? </p>