c++ - using catch(...) (ellipsis) for post-mortem analysis -


Any other query otherwise hold unconnected to hold (...) main () <{code> try {} with hold (...) {} block It seems like an interesting idea that can save a lot of time in debugging the program and gives at least one indication of what happened.

The essence of the question is what information can be retrieved << and how to recover it (to access and identify whatever Was caught)

In addition to this, which warning is attached to it. Specifically:

  • Will it play well with threads that will rise later?
  • Will not break the handling of segfaults (taken as a sign elsewhere)
  • This does not affect other efforts ... assuming the expected exceptions Essentially catch nested blocks?
  • Yes, that's a good idea.

    If you give the main part to avoid the exception, then this implementation is defined, the stack is uninterrupted before the weather closes. So in my opinion it is important that you catch all the exceptions in the main.

    The question is, what to do with them.
    See some OS (MS and SE), provide some additional debugging features so that it is useful to throw the exception again (because the stack is still useless) after catching it.

      int main (try /// all real code} // I see a little bit more in capturing other exceptions (// possibly better logging) if the exception is caught You may have gone / and it is decided that you should have done it here before. Grip (std :: exception const & amp; a) {// log e (...) A little better error message ... throwing; Hold (...) // Hold all the exceptions. Force the stack to open correctly {// You want to do something humble that is polite to throw; // throwing the exception again so that OS gives you the opportunity to debug  

It should have no effect threads. Normally you have to manually join any child's thread to ensure that they have left. The exact description of what happens to the main exhaust, when the main performance is not well defined (thus read your documentation), but usually all child threads will die instantly (a dirty and terrible death which opens up their heap Not included).

If you are talking about exceptions in hair thread. Then it is not well defined (so read your document), but if a thread exits through an exception (i.e. used to start the exit of the thread due to an exception and not return) , Then it usually causes the application to end (similar effect as above). Therefore it is best to always stop the exception all from exiting the thread.

  • Will not break segfaults (captured anywhere in the form of a signal)

Signal exception handling Are not affected by the mechanism.
However, because the signal handler can have a strange structure on the stack (to get the normal code back for its own return) it is not a good idea to throw an exception inside the signal handler because it has unexpected results. (And certainly not portable)

  • Will not this affect other efforts ... The block is essentially nested inside, which are supposed to handle the expected exceptions?

There should be no effect on other handlers.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -