Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::unexpected_handler(3)    C++ Standard Libary   std::unexpected_handler(3)

NAME
       std::unexpected_handler - std::unexpected_handler

Synopsis
	  Defined in header <exception>
	  typedef void (*unexpected_handler)();	 (deprecated in	C++11)
						 (removed in C++17)

	  std::unexpected_handler  is  the  function  pointer type (pointer to
       function	that takes
	  no arguments and returns void), which	is installed  and  queried  by
       the functions
	  std::set_unexpected and std::get_unexpected and called by std::unex-
       pected.

	  The  C++  implementation  provides a default std::unexpected_handler
       function, which
	  calls	std::terminate(). If the null pointer value is	installed  (by
       means of
	  std::set_unexpected),	 the  implementation  may  restore the default
       handler instead.

	  A user-defined std::unexpected_handler is expected to	either	termi-
       nate the	program
	  or throw an exception. If it throws an exception, one	of the follow-
       ing three
	  situations may be encountered:

	  1) the exception thrown by std::unexpected_handler satisfies the dy-
       namic exception
	  specification	 that  was  violated earlier. The new exception	is al-
       lowed to	escape the
	  function and stack unwinding continues.

	  2) the exception thrown by  std::unexpected_handler  still  violates
       the exception
	  specification:

	  2a)  however,	the exception specification allows std::bad_exception:
       the thrown
	  exception object is destroyed, and std::bad_exception	is constructed
       by the C++
	  runtime and thrown instead.

	  2b) the exception specification does not  allow  std::bad_exception:
       std::terminate()
	  is called.

See also
	  unexpected		     function  called  when  dynamic exception
       specification is
	  (removed in C++17)	    violated
				    (function)
	  set_unexpected	    changes  the  function  to	be  called  by
       std::unexpected
	  (removed in C++17)	    (function)
	  get_unexpected	    obtains the	current	unexpected_handler
	  (C++11)(removed in C++17) (function)

http://cppreference.com		  2022.07.31	    std::unexpected_handler(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::unexpected_handler&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help