1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4
5 struct BagOfInts
6 {
7 int x;
8 int y;
9 int z;
BagOfIntsBagOfInts10 BagOfInts(int X) :
11 x(X),
12 y(X+1),
13 z(X+2) {}
14 };
15
16 struct BagOfFloats
17 {
18 float x;
19 float y;
20 float z;
BagOfFloatsBagOfFloats21 BagOfFloats(float X) :
22 x(X+0.334),
23 y(X+0.500),
24 z(X+0.667) {}
25 };
26
27 struct BagOfBags
28 {
29 BagOfInts x;
30 BagOfInts y;
31 BagOfFloats z;
32 BagOfFloats q;
BagOfBagsBagOfBags33 BagOfBags() :
34 x('E'),
35 y('B'),
36 z(1.1),
37 q(20.11) {}
38 };
39
40 struct EmptyStruct {};
41
42 struct Plenty
43 {
44 BagOfInts *some_values;
45 int* array;
46 int array_size;
47 int bitfield;
48
PlentyPlenty49 Plenty(int N, bool flagA, bool flagB) :
50 some_values(new BagOfInts(N)),
51 array(new int[N]),
52 array_size(N),
53 bitfield( (flagA ? 0x01 : 0x00) | (flagB ? 0x10 : 0x00) )
54 {
55 for (int j = 0; j < N; j++)
56 array[j] = N-j;
57 }
58 };
59
main(int argc,const char * argv[])60 int main (int argc, const char * argv[])
61 {
62 BagOfInts int_bag(6);
63 BagOfFloats float_bag(2.71);
64
65 BagOfBags bag_bag;
66 EmptyStruct es;
67
68 Plenty plenty_of_stuff(5,true,false);
69
70 plenty_of_stuff.bitfield = 0x11; // Set break point at this line.
71
72 bag_bag.x.z = 12;
73
74 return 0;
75
76 }
77
78