user371968
user371968

Reputation: 39

exception handling

Is there any section in c++ for which we can not handle exceptions?

Upvotes: 1

Views: 241

Answers (3)

JoeG
JoeG

Reputation: 13192

There is only one situation where an exception handler cannot handle an exception - a function try/catch block around a constructor.

The catch block(s) can translate the exception caught, but they cannot exit without throwing. See here for a more complete discussion.


If you were asking about places from where exceptions cannot be thrown instead of where they cannot be handled then...

Throwing an exception fro a destructor is extremely ill advised. The circumstances under which it is safe are so hard to guarantee that you should just avoid ever throwing from a destructor.

Upvotes: 1

Olorin
Olorin

Reputation: 415

well the destructor must never throw and you must not use exception in signal handlers because that almost always doesn't end well if that's what your asking but your question is a bit vague.

Upvotes: 1

ckv
ckv

Reputation: 10838

You can throw an exception of your own and handle it. Are you trying to say places like constructors destructor in which case you can refer the following http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.2

Can you be more specific. What exactly are you looking for.

Upvotes: 1

Related Questions