Title
set_terminate and set_unexpected question
Status
nad
Section
[terminate]
Submitter
Judy Ward

Created on 2001-04-03.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

Infinite recursion is to be expected: users who set the terminate handler to terminate are explicitly asking for terminate to call itself.

Date: 2001-04-03.00:00:00

According to section 18.7.3.3 of the standard, std::terminate() is supposed to call the terminate_handler in effect immediately after evaluating the throw expression.

Question: what if the terminate_handler in effect is itself std::terminate?

For example:

  #include <exception>

  int main () {
      std::set_terminate(std::terminate);
      throw 5;
      return 0;
  }

Is the implementation allowed to go into an infinite loop?

I think the same issue applies to std::set_unexpected.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2206
2001-04-03 00:00:00admincreate