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 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 be re-ordered.

This is indeed very useful - Fortran has this since the Fortran 90 standard, albeit without the dots (it's unambiguous in Fortran).

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news

Reply via email to