Skip to content

Instantly share code, notes, and snippets.

@onqtam
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onqtam/909b9abb2a72cb313a89 to your computer and use it in GitHub Desktop.
Save onqtam/909b9abb2a72cb313a89 to your computer and use it in GitHub Desktop.
#include <cstdlib>
#include <iostream>
using namespace std;
struct RAII {
RAII() { cout << "ctor" << endl; }
~RAII() { cout << "dtor" << endl; }
};
RAII global; // dtor WILL be called!
int main(int argc, char** argv) {
RAII a; // dtor will NOT be called!
exit(7);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment