Created
August 2, 2012 17:17
-
-
Save nelhage/3238863 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 <stdlib.h> | |
#include <stdio.h> | |
struct doit_kwargs { | |
int a, b, c; | |
}; | |
void __doit(struct doit_kwargs kw) { | |
printf("%d %d %d\n", kw.a, kw.b, kw.c); | |
} | |
#define doit(...) __doit((struct doit_kwargs){__VA_ARGS__ }) | |
int main(void) { | |
doit(); | |
doit(1, .c = 1); | |
doit(.c = 1, .a = 4); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment