Skip to content

Instantly share code, notes, and snippets.

@nelhage
Created August 2, 2012 17:17
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 nelhage/3238863 to your computer and use it in GitHub Desktop.
Save nelhage/3238863 to your computer and use it in GitHub Desktop.
#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