Deutsch   English   Français   Italiano  
<v61bbh$1n9ij$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: Ivan Farlenkov <yo_99@mail.ru>
Newsgroups: comp.lang.c
Subject: Named arguments in C
Date: Tue, 2 Jul 2024 21:53:48 +0500
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <v61bbh$1n9ij$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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 02 Jul 2024 18:54:09 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7ee4f0802002d97dc8c45394d0719878";
	logging-data="1812051"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+xAYUepSenzdU32giK/TmtV8rAkKT5t0bpYbmBo/mbBg=="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TC4rqUfaMTzRrHdlL/w/TbiUU5I=
In-Reply-To: <utjhfn$2r0cr$1@dont-email.me>
Content-Language: en-US
Bytes: 1648

> 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)