#include <cstdlib>
#include <iostream>
void f1() {std::cout << "f1 called: ";}
void f2() {std::cout << "f2 called: ";}
void f3() {std::cout << "f3 called: ";}
int main()
{
at_quick_exit(f1);
at_quick_exit(f2);
at_quick_exit(f3);
quick_exit(EXIT_SUCCESS);
return 0;
}
// Output: f3 called: f2 called: f1 called:
Reference: http://www.cplusplus.com/reference/cstdlib/quick_exit/
Monday, September 18, 2017
C++11: At_Quick_Exit
C++11 added the function at_quick_exit to register functions that are called when quick_exit is called, after of which the process ends. Here is an example:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment