2 // Tests unsafe operators. address-of, dereference, member access
12 static int TestDereference ()
33 static int TestPtrAdd ()
35 int [] a = new int [10];
38 for (i = 0; i < 10; i++)
42 fixed (int *b = &a [0]){
45 for (i = 0; i < 10; i++){
57 static double d = 1.2;
58 static float f = 1.3F;
61 static int TestPtrAssign ()
68 fixed (char *cc = &c){
72 fixed (long *ll = &l){
76 fixed (double *dd = &d){
80 fixed (float *ff = &f){
84 fixed (short *ss = &s){
103 static int TestPtrArithmetic ()
105 char [] array = new char [10];
109 fixed (char *pa = array){
114 // This one tests pointer element access
119 Console.WriteLine ("V: " + (pb - pa));
137 Console.WriteLine ("VV: " + (pb - pa));
145 static int TestMultiple ()
147 char [] array = new char [10];
150 fixed (char *pa = array, pb = array){
162 if ((v = TestDereference ()) != 0)
165 if ((v = TestPtrAdd ()) != 0)
168 if ((v = TestPtrAssign ()) != 0)
171 if ((v = TestPtrArithmetic ()) != 0)
174 if ((v = TestMultiple ()) != 0)
177 Console.WriteLine ("Ok");