>>109075075
it's zero initialized by default so it is extremely ergonomic if you treat zeroed memory as valid state. with a simple macro trick it also gives C default arguments. because it's a pointer you can also nest it into deeper function calls without worrying about needlessly copying memory
typedef struct {
bool do_something;
int some_value;
const char* filename;
unsigned line;
} foo_opt;
#define foo(needed_value, ...) foo_((needed_value), &(foo_opt){ .some_value = 3, .filename = __FILE__, .line = __LINE__, __VA_ARGS__})
void foo_(int needed_value, foo_opt* options) {
return;
}
int main() {
foo(6, .some_value = 7);
foo(23, .filename = "bar", .do_something = true);
return 0;
}