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