C++ Logo


Advanced search

Re: Flexible function parameters

From: Bo Persson <bo_at_[hidden]>
Date: Thu, 9 Jul 2020 16:58:18 +0200
On 2020-07-09 at 16:28, Jake Arkinstall via Std-Proposals wrote:
> On Thu, 9 Jul 2020, 15:02 Arthur O'Dwyer, <arthur.j.odwyer_at_[hidden]
> <mailto:arthur.j.odwyer_at_[hidden]>> wrote:
> On Thu, Jul 9, 2020 at 9:32 AM Jake Arkinstall via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>> wrote:
> The why is clear.
> FWIW, no it's not. The OP didn't give any reason for the new syntax
> at all. In fact, the OP didn't even say what the new syntax is
> supposed to /*do!*/
> I thought OP's code examples were rather clear. Though, granted, a wordy
> explanation would be been helpful.
> What is `void f(int x, int y) {}` supposed to do differently from
> `void f(int x; int y) {}`
> Nothing, except that x can adopt a default value in the latter. Because
> its a separate logical group, you have a way of telling the compiler
> "adopt the defaults for the remainder of this parameter group".

This would probably need a more elaborate example here, as you can
already get the specific functionality using an overload:

void f(int x, int y);

void f(int y)
{ f(0, y); }

The committee is not that fond of new syntax for things already possible
in the current language (with a few exceptions :-) ).

    Bo Persson

Received on 2020-07-09 10:01:39