The trick is to declare struct variables as array of one element:
1 2 3 4 5 6 7 8 9 10 11 12 13 | struct foo { int A; }; struct bar { foo F[1]; }; void test() { bar Bar[1] = {}; Bar->F->A = 1; } |
It is not a perfect solution. for example:
1 2 3 4 5 | // This no longer works: // bar Bar[1] = InitializeBar(5); // you have to do this bar Bar[1]; *Bar = InitializeBar(5); |
Hopefully that doesn't confuse the optimizer :)