examples

Toy examples in single C files.
git clone git://henryandlizzy.uk/examples
Log | Files | Refs

atexit.cpp (384B)


      1 #include <cstdio>
      2 #include <cstdlib>
      3 
      4 struct foo
      5 {
      6 	~foo()
      7 	{
      8 		puts(__PRETTY_FUNCTION__);
      9 	}
     10 };
     11 
     12 static void atexit_func()
     13 {
     14 	puts(__PRETTY_FUNCTION__);
     15 }
     16 static void at_quick_exit_func()
     17 {
     18 	puts(__PRETTY_FUNCTION__);
     19 }
     20 
     21 
     22 int main()
     23 {
     24 	auto x = foo();
     25 
     26 	std::atexit(atexit_func);
     27 	std::at_quick_exit(at_quick_exit_func);
     28 
     29 
     30 //	std::_Exit(0);
     31 //	std::quick_exit(0);
     32 //	std::exit(0);
     33 }