[2020-02] Avoid following invalid pointers in mono_w32process_get_modules on Darwin...
[mono-project.git] / mono / tests / pointer.cs
blobb425801b481a24cabe96a67341e49bbc10f80030
1 using System;
3 public class Test {
5 public static IntPtr to_intptr (int value)
7 return new IntPtr (value);
10 unsafe public static int Main () {
11 int num = 0;
13 num++;
14 IntPtr a = to_intptr (1);
15 if ((int)a != 1)
16 return num;
18 num++;
19 if (sizeof (void*) != sizeof(IntPtr))
20 return num;
22 num++;
23 if (sizeof (byte*) != sizeof (void *))
24 return num;
26 num++;
27 if (sizeof (int*) != sizeof (int *))
28 return num;
30 num++;
31 if (sizeof (IntPtr) != 4 && sizeof (IntPtr) != 8)
32 return num;
34 return 0;