Created
May 13, 2017 19:41
-
-
Save weltling/41dbc8a78c0e63d1c99368dcb0e35745 to your computer and use it in GitHub Desktop.
vc variadic macro
This file contains 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
file.c: | |
#define f(a) ((a)>0)?1:0 | |
#define p(...) ,##__VA_ARGS__ | |
#define b(a,...) f(test(a p(__VA_ARGS__))) | |
int | |
main(int argc, char **argv) | |
{ | |
b("abc"); | |
} | |
preprocessed file.c: | |
#line 1 "var_macro.c" | |
int | |
main(int argc, char **argv) | |
{ | |
((test("abc" ))>0)?1:0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment