Deutsch English Français Italiano |
<v61la7$1p1hu$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Richard Harnden <richard.nospam@gmail.invalid> Newsgroups: comp.lang.c Subject: Re: Named arguments in C Date: Tue, 2 Jul 2024 20:44:07 +0100 Organization: A noiseless patient Spider Lines: 20 Message-ID: <v61la7$1p1hu$1@dont-email.me> References: <utgjh0$21nsq$2@dont-email.me> <uth66l$266da$1@dont-email.me> <uti83u$2ed01$4@dont-email.me> <utjhfn$2r0cr$1@dont-email.me> <v61bbh$1n9ij$1@dont-email.me> <pan$1e5a0$ef4a1faf$e6cedebc$3f30bac1@invalid.invalid> Reply-To: nospam.harnden@invalid.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 02 Jul 2024 21:44:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="94f00b9fe22971e96a85c08d3932c14a"; logging-data="1869374"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dko7dJ5o3baEydHhO8rv7+5AXufXzrsI=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:5FrpiWB+ILzZPuXlqPO0VPAVfyI= In-Reply-To: <pan$1e5a0$ef4a1faf$e6cedebc$3f30bac1@invalid.invalid> Content-Language: en-GB Bytes: 1748 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.