Deutsch English Français Italiano |
<v668hs$2pg1p$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c Subject: Re: Named arguments in C Date: Thu, 4 Jul 2024 15:37:06 +0200 Organization: A noiseless patient Spider Lines: 28 Message-ID: <v668hs$2pg1p$1@raubtier-asyl.eternal-september.org> 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> <v6602d$2o5t2$1@raubtier-asyl.eternal-september.org> <v665ok$2p0gr$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 04 Jul 2024 15:37:00 +0200 (CEST) Injection-Info: raubtier-asyl.eternal-september.org; posting-host="0cf7b18caa2fbce9b21bf27bec31d965"; logging-data="2932793"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZVjwsqOfDhhR79V2yr9r3eG/L69BUbEU=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:A1h4hzPHossWoNsPVirqWJ/lLJw= In-Reply-To: <v665ok$2p0gr$1@dont-email.me> Content-Language: de-DE Bytes: 2329 Am 04.07.2024 um 14:49 schrieb bart: > On 04/07/2024 12:12, Bonita Montero wrote: >> Am 02.07.2024 um 18:53 schrieb Ivan Farlenkov: >>>> I am a fan of being able to name parameters in languages that allow >>>> it. I am quite confident that this will never come to C. It /might/ >>>> make it into C++, but as people have been writing proposals to do so >>>> for 20 years at least, I am not holding my breath. >>> You can sort of already do it in C by using designated initializers >>> and macros >>> #define foo(A, B, C, ...) do{\ >>> stuct technical technical={\ >>> var1=default1,\ >>> var2=default2,\ >>> var3=default3 __VA_OPT__(,)\ >>> __VA_ARGS__\ >>> }\ >>> actual_foo(A, B, C, technical.var1, technical.var2, >>> technical.var3)\ >>> }while(0) >> >> What an anquated language that this needs macros. > > How do you do it in C++? > With a inline-function that returns an auto to make the inner type accessible.