1 //===-- main.cpp ------------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include <stdio.h> 11 #include <stdlib.h> 12 #include <stdint.h> 13 14 struct i_am_cool 15 { 16 int integer; 17 float floating; 18 char character; 19 i_am_cool(int I, float F, char C) : 20 integer(I), floating(F), character(C) {} 21 i_am_cool() : integer(1), floating(2), character('3') {} 22 23 }; 24 25 struct i_am_cooler 26 { 27 i_am_cool first_cool; 28 i_am_cool second_cool; 29 float floating; 30 31 i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) : 32 first_cool(I1,F1,C1), 33 second_cool(I2,F2,C2), 34 floating((F1 + F2)/2) {} 35 }; 36 37 struct IWrapPointers 38 { 39 int* int_pointer; 40 float* float_pointer; 41 IWrapPointers() : int_pointer(new int(4)), float_pointer(new float(1.111)) {} 42 }; 43 44 struct Simple 45 { 46 int x; 47 float y; 48 char z; 49 Simple(int X, float Y, char Z) : 50 x(X), 51 y(Y), 52 z(Z) 53 {} 54 }; 55 56 struct SimpleWithPointers 57 { 58 int *x; 59 float *y; 60 char *z; 61 SimpleWithPointers(int X, float Y, char Z) : 62 x(new int (X)), 63 y(new float (Y)), 64 z(new char[2]) 65 { 66 z[0] = Z; 67 z[1] = '\0'; 68 } 69 }; 70 71 struct Couple 72 { 73 SimpleWithPointers sp; 74 Simple* s; 75 Couple(int X, float Y, char Z) : sp(X,Y,Z), 76 s(new Simple(X,Y,Z)) {} 77 }; 78 79 struct VeryLong 80 { 81 int a_1; 82 int b_1; 83 int c_1; 84 int d_1; 85 int e_1; 86 int f_1; 87 int g_1; 88 int h_1; 89 int i_1; 90 int j_1; 91 int k_1; 92 int l_1; 93 int m_1; 94 int n_1; 95 int o_1; 96 int p_1; 97 int q_1; 98 int r_1; 99 int s_1; 100 int t_1; 101 int u_1; 102 int v_1; 103 int w_1; 104 int x_1; 105 int y_1; 106 int z_1; 107 108 int a_2; 109 int b_2; 110 int c_2; 111 int d_2; 112 int e_2; 113 int f_2; 114 int g_2; 115 int h_2; 116 int i_2; 117 int j_2; 118 int k_2; 119 int l_2; 120 int m_2; 121 int n_2; 122 int o_2; 123 int p_2; 124 int q_2; 125 int r_2; 126 int s_2; 127 int t_2; 128 int u_2; 129 int v_2; 130 int w_2; 131 int x_2; 132 int y_2; 133 int z_2; 134 }; 135 136 int main (int argc, const char * argv[]) 137 { 138 139 int iAmInt = 9; 140 141 i_am_cool cool_boy(1,0.5,3); 142 i_am_cooler cooler_boy(1,2,0.1,0.2,'A','B'); 143 144 i_am_cool *cool_pointer = new i_am_cool(3,-3.141592,'E'); 145 146 i_am_cool cool_array[5]; 147 148 cool_array[3].floating = 5.25; 149 cool_array[4].integer = 6; 150 cool_array[2].character = 'Q'; 151 152 int int_array[] = {1,2,3,4,5}; 153 154 IWrapPointers wrapper; 155 156 *int_array = -1; 157 158 int* pointer = &cool_array[4].integer; 159 160 IWrapPointers *wrap_pointer = &wrapper; 161 162 Couple couple(9,9.99,'X'); 163 164 SimpleWithPointers sparray[] = 165 {SimpleWithPointers(-1,-2,'3'), 166 SimpleWithPointers(-4,-5,'6'), 167 SimpleWithPointers(-7,-8,'9')}; 168 169 Simple a_simple_object(3,0.14,'E'); 170 171 VeryLong a_long_guy; 172 173 return 0; // Set break point at this line. 174 } 175