Skip to content

Instantly share code, notes, and snippets.

@weltling
Created May 13, 2017 19:41
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 weltling/41dbc8a78c0e63d1c99368dcb0e35745 to your computer and use it in GitHub Desktop.
Save weltling/41dbc8a78c0e63d1c99368dcb0e35745 to your computer and use it in GitHub Desktop.
vc variadic macro
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