Straight into the code, this is the technique:
typedef struct { int year; const wchar_t *name; } Foo_args; // parameters void Foo_func(Foo_args args) { int x = args.year + 10; // use the argument } #define Foo(...) Foo_func((Foo_args){ __VA_ARGS__ })And this is how you call the function:
Foo(.year = 2014, .name = L"Rodrigo");The function calling is clear, and its implementation doesn’t add much noise to the code: I believe the price is payable and the result is worth.
No comments:
Post a Comment