Skip to content

Instantly share code, notes, and snippets.

@josephnoir
Created September 19, 2014 15:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save josephnoir/c948b78bf586ae4fa361 to your computer and use it in GitHub Desktop.
Little example for static initialization in C++.
#include <iostream>
using namespace std;
struct foo {
foo() : data(1) { }
int data;
};
static foo bar;
int main() {
cout << bar.data << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment