GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::set_terminate(3) C++ Standard Libary std::set_terminate(3)

std::set_terminate - std::set_terminate


Defined in header <exception>
std::terminate_handler set_terminate( std::terminate_handler f ) (until C++11)
throw();
std::terminate_handler set_terminate( std::terminate_handler f ) (since C++11)
noexcept;


Makes f the new global terminate handler function and returns the previously
installed std::terminate_handler.


This function is thread-safe. Every call to std::set_terminate
synchronizes-with (see std::memory_order) the subsequent (since C++11)
std::set_terminate and std::get_terminate


f - pointer to function of type std::terminate_handler, or null pointer


The previously-installed terminate handler, or a null pointer value if none was
installed.

// Run this code


#include <iostream>
#include <cstdlib>
#include <exception>


int main()
{
std::set_terminate([](){
std::cout << "Unhandled exception" << std::endl;
std::abort();
});
throw 1;
}


Unhandled exception
bash: line 7: 7743 Aborted (core dumped) ./a.out


terminate function called when exception handling fails
(function)
get_terminate obtains the current terminate_handler
(C++11) (function)
terminate_handler the type of the function called by std::terminate
(typedef)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.