func(a=a, d=10);

this can be emulated with a struct:

struct Fs{
int a = 1;
long d = 55;
char c = 14;
};

void func(Fs x);

int main(){
func({ .a = 5, .d = 10 });
}






On Tue, Dec 29, 2020 at 8:59 PM Vishal Oza via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
I would like to add another point of view and add the ability to assign values to the function parameters, it would do the same thing but in a different way. I think I had proposed the same idea a few years ago. 

int func(int a, int b = 6, int c = 7, int d = 8);
func(a, default, default, 10);  
OR
int func(int a, int b = 6, int c = 7, int d = 8);
func(a=a, d=10);

compiler writers with both GCC and clang/LLVM could give you better feedback about adding this feature to the language.

On Tue, Dec 29, 2020 at 12:36 PM sasho648 via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
Hello so I have some functions that I want to specify for example the very last argument but there are default parameter preceding it that I don't want to touch. I suggest to allow the use of the `default` keyword to fill those with their default values. Here is an example:

int func(int a, int b = 6, int c = 7, int d = 8);

Here I want to only set the last d parameter without touching the b and c, leaving them default so my call would look something like this:

func(a, default, default, 10);

I hope you understand what my suggestion is and its purpose.

Thanks.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals