Skip to content

Instantly share code, notes, and snippets.

@willeccles
Created July 25, 2015 23:52
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 willeccles/d1691ece933fcba6b903 to your computer and use it in GitHub Desktop.
Save willeccles/d1691ece933fcba6b903 to your computer and use it in GitHub Desktop.
/// test #1
#define u using
#define n namespace
#define s std
// so can this work?
u n s;
// yes indeed it can!
/// test #2
#define spit return
// does it work?
int meaningOfLife() {
spit 42;
}
// meaningOfLife() returns 42
/// test #3 - let's go more in depth.
#define thing int
#define methodName meaningOfLife()
#define answer 42
// let's test it:
thing methodName {
// we defined spit before so I didn't redefine it
spit answer;
}
// that returns 42!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment