Sujet : Re: Named arguments in C
De : bluemanedhawk (at) *nospam* invalid.invalid (Blue-Maned_Hawk)
Groupes : comp.lang.cDate : 03. Jul 2024, 21:16:33
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <pan$9627a$afbb0d44$f2f0aac5$8cdb0dac@invalid.invalid>
References : 1 2 3 4 5 6 7
User-Agent : Pan/0.154 (Izium; 517acf4)
Richard Harnden wrote:
On 02/07/2024 20:39, Blue-Maned_Hawk wrote:
I searched around a bit, and it seems like a more common way to
implement 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 */
}
int main(void)
{
f(.i = 0, .j = 2, .l = 2.5, .k = "foo", .n = 4.2, .m = 2.5);
}
That's the kind of thing Bonita would write.
Horrible.
I assure you that i can write much worse code. What do you say makes this
is horrible?
-- Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.blue-maned_hawk.srht.siteIt's like this other thing, except awful!