Last active
August 29, 2015 14:01
-
-
Save letoh/3976d4c6fcbbe85ca489 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #define progn(...) ({ __VA_ARGS__ ;}) | |
| #define cond0 (argc < 2) | |
| #define cond1 (argc < 3) | |
| #define cond2 (argc < 4) | |
| #define cond3 (argc < 5) | |
| #define a progn(printf("do something\n"), "a") | |
| #define b ("b", "bb", "bbb", "bbbb") | |
| #define c progn(\ | |
| for(int i = argc; i; --i)\ | |
| printf("i = %d\n", i);\ | |
| "c") | |
| #define d "d" | |
| #define e "e" | |
| int main(int argc, char *argv[]) | |
| { | |
| char *value = | |
| cond0 ? a : | |
| cond1 ? b : | |
| cond2 ? c : | |
| cond3 ? d : | |
| e; | |
| printf("value = %s\n", value); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment