Skip to content

Instantly share code, notes, and snippets.

@xyzz
Created February 27, 2014 19:26
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 xyzz/157b4dcca0ec792864e3 to your computer and use it in GitHub Desktop.
Save xyzz/157b4dcca0ec792864e3 to your computer and use it in GitHub Desktop.
xyz@xyz-pc /tmp $ cat test.c
int main() {
#if defined(linux)
return 1;
#elif defined(__linux)
return 2;
#elif defined(__linux__)
return 3;
#endif
}
xyz@xyz-pc /tmp $ g++ test.c && ./a.out; echo $?
1
xyz@xyz-pc /tmp $ g++ -std=c++0x test.c && ./a.out; echo $?
2
xyz@xyz-pc /tmp $ g++ -std=c++11 test.c && ./a.out; echo $?
2
xyz@xyz-pc /tmp $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment