199451b44SJordan Rupprecht #include <stdio.h>
299451b44SJordan Rupprecht #include <stdlib.h>
399451b44SJordan Rupprecht #include <stdint.h>
499451b44SJordan Rupprecht
599451b44SJordan Rupprecht typedef float RealNumber; // should show as char
699451b44SJordan Rupprecht typedef RealNumber Temperature; // should show as float
799451b44SJordan Rupprecht typedef RealNumber Speed; // should show as hex
899451b44SJordan Rupprecht
999451b44SJordan Rupprecht typedef int Counter; // should show as int
1099451b44SJordan Rupprecht typedef int BitField; // should show as hex
1199451b44SJordan Rupprecht
1299451b44SJordan Rupprecht typedef BitField SignalMask; // should show as hex
1399451b44SJordan Rupprecht typedef BitField Modifiers; // should show as hex
1499451b44SJordan Rupprecht
1599451b44SJordan Rupprecht typedef Counter Accumulator; // should show as int
1699451b44SJordan Rupprecht
1799451b44SJordan Rupprecht typedef int Type1; // should show as char
1899451b44SJordan Rupprecht typedef Type1 Type2; // should show as hex
1999451b44SJordan Rupprecht typedef Type2 Type3; // should show as char
2099451b44SJordan Rupprecht typedef Type3 Type4; // should show as char
2199451b44SJordan Rupprecht
2299451b44SJordan Rupprecht typedef int ChildType; // should show as int
2399451b44SJordan Rupprecht typedef int AnotherChildType; // should show as int
2499451b44SJordan Rupprecht
25ac7c8808SRaphael Isemann struct TestPoint {
2699451b44SJordan Rupprecht int x;
2799451b44SJordan Rupprecht int y;
TestPointTestPoint28ac7c8808SRaphael Isemann TestPoint(int X = 3, int Y = 2) : x(X), y(Y) {}
2999451b44SJordan Rupprecht };
3099451b44SJordan Rupprecht
3199451b44SJordan Rupprecht typedef float ShowMyGuts;
3299451b44SJordan Rupprecht
3399451b44SJordan Rupprecht struct i_am_cool
3499451b44SJordan Rupprecht {
3599451b44SJordan Rupprecht int integer;
3699451b44SJordan Rupprecht ShowMyGuts floating;
3799451b44SJordan Rupprecht char character;
i_am_cooli_am_cool3899451b44SJordan Rupprecht i_am_cool(int I, ShowMyGuts F, char C) :
3999451b44SJordan Rupprecht integer(I), floating(F), character(C) {}
i_am_cooli_am_cool4099451b44SJordan Rupprecht i_am_cool() : integer(1), floating(2), character('3') {}
4199451b44SJordan Rupprecht
4299451b44SJordan Rupprecht };
4399451b44SJordan Rupprecht
4499451b44SJordan Rupprecht struct i_am_cooler
4599451b44SJordan Rupprecht {
4699451b44SJordan Rupprecht i_am_cool first_cool;
4799451b44SJordan Rupprecht i_am_cool second_cool;
4899451b44SJordan Rupprecht ShowMyGuts floating;
4999451b44SJordan Rupprecht
i_am_cooleri_am_cooler5099451b44SJordan Rupprecht i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) :
5199451b44SJordan Rupprecht first_cool(I1,F1,C1),
5299451b44SJordan Rupprecht second_cool(I2,F2,C2),
5399451b44SJordan Rupprecht floating((F1 + F2)/2) {}
5499451b44SJordan Rupprecht };
5599451b44SJordan Rupprecht
5699451b44SJordan Rupprecht struct IUseCharStar
5799451b44SJordan Rupprecht {
5899451b44SJordan Rupprecht const char* pointer;
IUseCharStarIUseCharStar5999451b44SJordan Rupprecht IUseCharStar() : pointer("Hello world") {}
60554f79e0SMichael Buch
member_funcIUseCharStar61554f79e0SMichael Buch char const *member_func(int) { return ""; }
virt_member_funcIUseCharStar62554f79e0SMichael Buch virtual void virt_member_func() {}
6399451b44SJordan Rupprecht };
6499451b44SJordan Rupprecht
has_local_mem_func_pointers()65110ce5abSMichael Buch void has_local_mem_func_pointers() {
66110ce5abSMichael Buch const char *IUseCharStar::*member_ptr = &IUseCharStar::pointer;
67110ce5abSMichael Buch const char *(IUseCharStar::*member_func_ptr)(int) =
68110ce5abSMichael Buch &IUseCharStar::member_func;
69110ce5abSMichael Buch auto &ref_to_member_func_ptr = member_func_ptr;
70110ce5abSMichael Buch
71110ce5abSMichael Buch void (IUseCharStar::*virt_member_func_ptr)() =
72110ce5abSMichael Buch &IUseCharStar::virt_member_func;
73*905a7577SMichael Buch
74*905a7577SMichael Buch ::puts("Break in has_local_mem_func_pointers");
75110ce5abSMichael Buch }
76110ce5abSMichael Buch
main(int argc,const char * argv[])7799451b44SJordan Rupprecht int main (int argc, const char * argv[])
7899451b44SJordan Rupprecht {
7999451b44SJordan Rupprecht
8099451b44SJordan Rupprecht int iAmInt = 1;
8199451b44SJordan Rupprecht const float& IAmFloat = float(2.45);
8299451b44SJordan Rupprecht
8399451b44SJordan Rupprecht RealNumber RNILookChar = 3.14;
8499451b44SJordan Rupprecht Temperature TMILookFloat = 4.97;
8599451b44SJordan Rupprecht Speed SPILookHex = 5.55;
8699451b44SJordan Rupprecht
8799451b44SJordan Rupprecht Counter CTILookInt = 6;
8899451b44SJordan Rupprecht BitField BFILookHex = 7;
8999451b44SJordan Rupprecht SignalMask SMILookHex = 8;
9099451b44SJordan Rupprecht Modifiers MFILookHex = 9;
9199451b44SJordan Rupprecht
9299451b44SJordan Rupprecht Accumulator* ACILookInt = new Accumulator(10);
9399451b44SJordan Rupprecht
9499451b44SJordan Rupprecht const Type1& T1ILookChar = 11;
9599451b44SJordan Rupprecht Type2 T2ILookHex = 12;
9699451b44SJordan Rupprecht Type3 T3ILookChar = 13;
9799451b44SJordan Rupprecht Type4 T4ILookChar = 14;
9899451b44SJordan Rupprecht
9999451b44SJordan Rupprecht AnotherChildType AHILookInt = 15;
10099451b44SJordan Rupprecht
10199451b44SJordan Rupprecht Speed* SPPtrILookHex = new Speed(16);
10299451b44SJordan Rupprecht
103ac7c8808SRaphael Isemann TestPoint iAmSomewhere(4,6);
10499451b44SJordan Rupprecht
10599451b44SJordan Rupprecht i_am_cool *cool_pointer = (i_am_cool*)malloc(sizeof(i_am_cool)*3);
10699451b44SJordan Rupprecht cool_pointer[0] = i_am_cool(3,-3.141592,'E');
10799451b44SJordan Rupprecht cool_pointer[1] = i_am_cool(0,-3.141592,'E');
10899451b44SJordan Rupprecht cool_pointer[2] = i_am_cool(0,-3.141592,'E');
10999451b44SJordan Rupprecht
11099451b44SJordan Rupprecht i_am_cool cool_array[5];
11199451b44SJordan Rupprecht
11299451b44SJordan Rupprecht cool_array[3].floating = 5.25;
11399451b44SJordan Rupprecht cool_array[4].integer = 6;
11499451b44SJordan Rupprecht cool_array[2].character = 'Q';
11599451b44SJordan Rupprecht
11699451b44SJordan Rupprecht int int_array[] = {1,2,3,4,5};
11799451b44SJordan Rupprecht
11899451b44SJordan Rupprecht IUseCharStar iEncapsulateCharStar;
11999451b44SJordan Rupprecht
12099451b44SJordan Rupprecht char strarr[32] = "Hello world!";
12199451b44SJordan Rupprecht char* strptr = "Hello world!";
12299451b44SJordan Rupprecht
12399451b44SJordan Rupprecht i_am_cooler the_coolest_guy(1,2,3.14,6.28,'E','G');
12499451b44SJordan Rupprecht
125110ce5abSMichael Buch has_local_mem_func_pointers();
126554f79e0SMichael Buch
12799451b44SJordan Rupprecht return 0; // Set break point at this line.
12899451b44SJordan Rupprecht }
12999451b44SJordan Rupprecht
130