The following are mainly notes for experiment Two and experiment three:
April 13, 2015 P111.arr,&arr (arr+1), (&arr+1) difference: One variable corresponds to a memory eg. address: 0x10000->&arr content:0x20000-> Arr array is exception: 1) array name arr->&arr[0] arr[0]->int (first address of array) INT * *) typedef int Array[10]array a;//sizeof (a)- >40&arr->array*sizeof (arr);->403) so: arr//10000 (arr+1)//10004 (&arr+1)//100402.p395 source code C language Conventions, Right-to-left "argument elevation" int printf (char *fmt,...) {usigned int addr = (usigned int) (&FMT), addr + = sizeof (char*),//1004double *prt = (double*) addr;*prtdouble h = * ((Doub Le *) addr); addr + = sizeof (double);} 3. Experiment two variable argumentva_arg ptr//1iptr//4 do int myprintf (const char,...) {*format}
April 27, 2015 1. is not a virtual method base::h (...); /static bindings pre-compile Base->f (10,20);//dynamic BIND runtime 2. Global variable int c_data;class base{int b_data;static int c_data;void h (int a, int b) {} virtual void f (int a, int b) {}}->struct base{int b_data;}; void Base_h (base* this/* non-static, to point to a method */,int a, int b) void Base_f (base* this/* non-static, to point to a method */,int a, int b) 3.void f (void) {}void g (void) {}typedef void (*func_ptr) (void); void Test (func_ptr ptr) {ptr (); int main () {test (f); Test (g);}
"Compiling principle" lesson notes 2