On 11/12/22 13:34, Alejandro Colomar wrote:
struct s { int a; };struct t { struct s s; int a; }; void f(void) { struct t x = { .a = 1, .s = { .a = ((struct s) {.a = 1}).a, }, }; }
From here, a demonstration of what I understood from Martin's email is that there's also an idea of allowing the following:
struct s {
int a;
int b;
};
struct t {
struct s s;
int a;
int b;
};
void f(void)
{
struct t x = {
.a = 1,
.s = {
// In the following line, .b=.a is assigning 2
.a = ((struct s) {.a = 2, .b = .a}).b,
// The previous line assigned 2, since the compound had 2 in .b
},
// In the following line, .b=.a is assigning 1
.b = .a,
};
}
--
<http://www.alejandro-colomar.es/>
OpenPGP_signature
Description: OpenPGP digital signature
