On Friday, 27 January 2017 at 12:59:54 UTC, Kagamin wrote:
On Friday, 27 January 2017 at 11:16:09 UTC, Patrick Schluter wrote:
It's funny (or sad) that C has compound types since C99 and that they are good.
Your  foo(|a,b,|c1,c2,3||,|e|,|f,g,c|) writes as

foo((T1){a,b,{c1,c2,c3}}, (T2){e}, (T3){f,g,c});

of course, the lack of object orientation and other things makes it easier in C.

It's struct literals, a gcc extension, not in language.

No, they're named compound* literals and they are in the language since C99.

https://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Compound-Literals.html

* They can be used to initialise also unions and arrays. (int [10]){0,2,[8]=2} is absolutely legal p.ex.

Reply via email to