Re: Named arguments in C

Liste des GroupesRevenir à cl c 
Sujet : Re: Named arguments in C
De : Bonita.Montero (at) *nospam* gmail.com (Bonita Montero)
Groupes : comp.lang.c
Date : 04. Jul 2024, 14:46:35
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6693l$2pir4$1@raubtier-asyl.eternal-september.org>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
Am 04.07.2024 um 15:39 schrieb bart:
On 04/07/2024 14:37, Bonita Montero wrote:
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.
>
 I meant, what do you have to do to get named arguments in C++?
 Is it more of a nightmare than in C or less?
With an additional constructor for technical everything is fine.

Date Sujet#  Auteur
21 Mar 24 * Re: Block Comments Or Rest-Of-Line Comments?30Lawrence D'Oliveiro
22 Mar 24 `* Re: Block Comments Or Rest-Of-Line Comments?29David Brown
22 Mar 24  +- Re: Block Comments Or Rest-Of-Line Comments?1Blue-Maned_Hawk
23 Mar 24  +* Re: Block Comments Or Rest-Of-Line Comments?5Lawrence D'Oliveiro
23 Mar 24  i+* Re: Block Comments Or Rest-Of-Line Comments?2Chris M. Thomasson
23 Mar 24  ii`- Re: Block Comments Or Rest-Of-Line Comments?1Lawrence D'Oliveiro
23 Mar 24  i`* Re: Block Comments Or Rest-Of-Line Comments?2David Brown
23 Mar 24  i `- Re: Block Comments Or Rest-Of-Line Comments?1Malcolm McLean
2 Jul 24  `* Named arguments in C22Ivan Farlenkov
2 Jul 24   +* Re: Named arguments in C12Blue-Maned_Hawk
2 Jul 24   i+* Re: Named arguments in C4Richard Harnden
3 Jul 24   ii`* Re: Named arguments in C3Blue-Maned_Hawk
4 Jul 24   ii `* Re: Named arguments in C2Richard Harnden
4 Jul 24   ii  `- Re: Named arguments in C1Kaz Kylheku
2 Jul 24   i`* Re: Named arguments in C7bart
2 Jul 24   i +- Re: Named arguments in C1Keith Thompson
3 Jul 24   i +* Re: Named arguments in C4Blue-Maned_Hawk
4 Jul 24   i i`* Re: Named arguments in C3bart
4 Jul 24   i i `* Re: Named arguments in C2Keith Thompson
4 Jul 24   i i  `- Re: Named arguments in C1Kaz Kylheku
4 Jul 24   i `- Re: Named arguments in C1Opus
3 Jul 24   +- Re: Named arguments in C1Lawrence D'Oliveiro
4 Jul 24   `* Re: Named arguments in C8Bonita Montero
4 Jul 24    +* Re: Named arguments in C2Michael S
4 Jul 24    i`- Re: Named arguments in C1Michael S
4 Jul 24    `* Re: Named arguments in C5bart
4 Jul 24     `* Re: Named arguments in C4Bonita Montero
4 Jul 24      +- Re: Named arguments in C1Bonita Montero
4 Jul 24      `* Re: Named arguments in C2bart
4 Jul 24       `- Re: Named arguments in C1Bonita Montero

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal