81 lines · c
1struct anonymous_nest {2 struct {3 struct {4 int a;5 int b;6 }; // anonymous7 struct {8 int c;9 int d;10 } foo;11 }; // anonymous12};13 14struct anonymous_child {15 struct {16 struct {17 int a;18 int b;19 } grandchild;20 struct {21 int c;22 int d;23 } foo;24 }; // anonymous25};26 27struct anonymous_grandchild {28 struct {29 struct {30 int a;31 int b;32 }; // anonymous33 struct {34 int c;35 int d;36 } foo;37 } child;38};39 40int processor_nest (struct anonymous_nest *n)41{42 return n->foo.d + n->b; // Set breakpoint 0 here.43}44 45int processor_child (struct anonymous_child *c)46{47 return c->foo.d + c->grandchild.b; // Set breakpoint 1 here.48}49 50int processor_grandchild (struct anonymous_grandchild *g)51{52 return g->child.foo.d + g->child.b;53}54 55 56 57typedef struct {58 int dummy;59} type_y;60 61typedef struct {62 type_y y;63} type_z;64 65 66 67int main()68{69 struct anonymous_nest n = { 0, 2, 0, 4 };70 struct anonymous_child c = { 0, 2, 0, 4 };71 struct anonymous_grandchild g = { 0, 2, 0, 4 };72 type_z *pz = 0;73 type_z z = {{2}};74 75 processor_nest(&n);76 processor_child(&c);77 processor_grandchild(&g); // Set breakpoint 2 here.78 79 return 0;80}81