File tree 6 files changed +48
-1
lines changed
6 files changed +48
-1
lines changed Original file line number Diff line number Diff line change
1
+ testapp
2
+
1
3
# Prerequisites
2
4
* .d
3
5
Original file line number Diff line number Diff line change 6
6
7
7
mv lib/* .so .
8
8
9
- g++ -std=c++17 -L. -ltest -Wl,-rpath=' ${ORIGIN}' -o testapp testapp.cpp
9
+ g++ -std=c++14 -L. -ltest -Wl,-rpath=' ${ORIGIN}' -o testapp testapp.cpp
10
10
Original file line number Diff line number Diff line change @@ -17,3 +17,19 @@ void printStructInfo11()
17
17
<< " ) n: (" << &(b.n ) << " ) o(" << &(b.o ) << " )\n " ;
18
18
19
19
}
20
+
21
+ void printStruct2Info11 ()
22
+ {
23
+
24
+ std::cout << " \n C++ 11\n " ;
25
+ A2 a;
26
+ std::cout << " Size of A2: " << sizeof (A2) << ' \n ' ;
27
+ std::cout << " Memory locations: m(" << &(a.m )
28
+ << " ) n: (" << &(a.n ) << " )\n " ;
29
+
30
+ B2 b;
31
+ std::cout << " Size of B2: " << sizeof (B2) << ' \n ' ;
32
+ std::cout << " Memory locations: m(" << &(b.m )
33
+ << " ) n: (" << &(b.n ) << " ) o(" << &(b.o ) << " )\n " ;
34
+
35
+ }
Original file line number Diff line number Diff line change @@ -13,3 +13,16 @@ struct B : public A
13
13
14
14
void printStructInfo11 ();
15
15
16
+ struct A2
17
+ {
18
+ uint16_t m{3 };
19
+ bool n;
20
+ };
21
+
22
+ struct B2 : public A2
23
+ {
24
+ bool o;
25
+ };
26
+
27
+ void printStruct2Info11 ();
28
+
Original file line number Diff line number Diff line change @@ -18,11 +18,27 @@ void printStructInfo14()
18
18
19
19
}
20
20
21
+ void printStruct2Info14 ()
22
+ {
23
+ std::cout << " \n C++ 14\n " ;
24
+ A2 a;
25
+ std::cout << " Size of A2: " << sizeof (A2) << ' \n ' ;
26
+ std::cout << " Memory locations: m(" << &(a.m )
27
+ << " ) n: (" << &(a.n ) << " )\n " ;
28
+
29
+ B2 b;
30
+ std::cout << " Size of B2: " << sizeof (B2) << ' \n ' ;
31
+ std::cout << " Memory locations: m(" << &(b.m )
32
+ << " ) n: (" << &(b.n ) << " ) o(" << &(b.o ) << " )\n " ;
33
+
34
+ }
21
35
int main ()
22
36
{
23
37
24
38
printStructInfo11 ();
25
39
printStructInfo14 ();
26
40
41
+ printStruct2Info11 ();
42
+ printStruct2Info14 ();
27
43
}
28
44
You can’t perform that action at this time.
0 commit comments