Skip to content

Instantly share code, notes, and snippets.

@fkaa
Created September 25, 2014 16:52
Show Gist options
  • Save fkaa/9b4a7e17ef17b2b361c7 to your computer and use it in GitHub Desktop.
Save fkaa/9b4a7e17ef17b2b361c7 to your computer and use it in GitHub Desktop.
#include "stoff.h"
//expands into 'class stoff;'
//without the include guard (#ifndef), the following:
#include "stoff.h"
#include "stoff.h"
#include "stoff.h"
//would expand into:
class stoff;
class stoff;
class stoff;
//leading to multiple definitions
other_stuff();
#ifndef A_MACRO
#define A_MACRO
class stoff;
#endif // A_MACRO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment