Skip to content

Instantly share code, notes, and snippets.

@xyzz

xyzz/gist:157b4dcca0ec792864e3 Secret

Created Feb 27, 2014
Embed
What would you like to do?
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
You can’t perform that action at this time.