Rune - Content-locking work 1/2
[rune.git] / tests / sizeof.d
1 #!/usr/local/bin/rune -x
2 #
3 #       Test sizeof(), arysize(), and typeof().
4
5 limport "sys";
6 import "stdio";
7
8 typedef int myint = 4;
9
10 class Obj1 {
11         global const int a = 4;
12         int b;
13 }
14
15 int
16 main(int ac, char **av)
17 {
18         Fd fd;
19         int x = sizeof(const (int, char));
20         int i;
21         int j;
22         int k;
23
24         k = 666;
25         for (i = 0; i < x; i = i + 1)
26                 j = 456;
27         k = k + 666;
28         for (i = 0; i < x; i = i + 1)
29                 j = 456;
30
31         fd.setfd(1);
32         k = 666;
33         for (i = 0; i < x; i = i + 1) {
34                 fd.write("x", 1);
35                 j = 456;
36         }
37         k = k + 666;
38         j = 456;
39         fd.write("\n", 1);
40         fd.write("xxxxxxxx\n", 9);
41
42         stdio.stderr->show("sizeof ", sizeof(Obj1));
43         stdio.stderr->show("sizeof ", 4);
44
45         return(0);
46 }