When an exception is thrown, control is transferred to the nearest handler with a type that matches the type of the exception thrown. If no matching handler is directly found within the handlers for a try block in which the exception is thrown, the search for a matching handler continues to dynamically search for handlers in the surrounding try blocks of the same thread. The C++ Standard, [except.handle], paragraph 9 [ISO/IEC 14882-2014], states:
If no matching handler is found, the function
std::terminate()
is called; whether or not the stack is unwound before this call tostd::terminate()
is implementation-defined.
...
SEI CERT C++ Coding Standard | |
MITRE CWE | CWE-754, Improper Check for Unusual or Exceptional Conditions |
Bibliography
[ISO/IEC 14882-2014] | Subclause 15.1, "Throwing an Exception" |
[MISRA 08] | Rule 15-3-2 (Advisory) Rule 15-3-4 (Required) |
...