On 16/03/15 17:34, Marc Glisse wrote:
> On Mon, 16 Mar 2015, David Brown wrote:
>
>> In a discussion on comp.lang.c, the subject of "named parameters" (or
>> "designated parameters") has come up again. This is a feature that some
>> of us feel would be very useful in C (and in C++). I think it w
Note that a proposal for named arguments was recently presented to the C++
standards committee [1], and they did not seem receptive to it [2].
The proposal was for a different syntax (name : value), but the objections were
not related to the syntax.
Regards,
Nate
[1] http://open-std.org/JTC1/S
> >If only the first variant is allowed (with the named parameters in the
> >order declared in the prototype), then this would not affect code
> >generation at all - the designators could only be used for static error
> >checking.
> >
> >If the second variant is allowed, then the parameters could b
On 03/16/2015 05:06 PM, David Brown wrote:
Basically, the idea is this:
int foo(int a, int b, int c);
void bar(void) {
foo(1, 2, 3); // Normal call
foo(.a = 1, .b = 2, .c = 3) // Same as foo(1, 2, 3)
foo(.c = 3, .b = 2, .a = 1) // Same as foo(1, 2, 3)
}
If on
On Mon, 16 Mar 2015, David Brown wrote:
In a discussion on comp.lang.c, the subject of "named parameters" (or
"designated parameters") has come up again. This is a feature that some
of us feel would be very useful in C (and in C++). I think it would be
possible to include it in the language wi