Liste des Groupes | Revenir à cl c |
I searched around a bit, and it seems like a more common way to implementYou missed out accesses to the parameters which would look like f_params.i and f_params.m.
named arguments in C is with a pattern like this:
#define f(...) f_impl((struct f_struct){__VA_ARGS__})
void f_impl(struct f_struct { int i, j; char * k; double l, m, n; }
f_params)
{
/* actual code */
}This addresses a small part of it. Named parameters allow arguments to be omitted, and that requires also default values to be defined.
int main(void)
{
f(.i = 0, .j = 2, .l = 2.5, .k = "foo", .n = 4.2, .m = 2.5);
}
Les messages affichés proviennent d'usenet.