Rune - Further Object abstraction work
[rune.git] / tests / align.d
1 #!/usr/local/bin/rune -x
2 #
3 #       Demonstrate the use of compound types.
4 #
5
6 import "sys";
7 import <stdio>;
8
9 alias stdio.File @stdout = stdio.stdout;
10
11 struct Test {
12     int a = 1;
13     __align(4) int64_t b = 23;
14     int64_t c = -1;
15     uint64_t d = -1;
16 }
17
18 int
19 main(int ac, string_p *av)
20 {
21     Test x[2];
22
23     stdout->show("Sizeof(x) should be 64:", sizeof(x));
24     stdout->show("x.a should be 1:", x[1].a);
25     stdout->show("x.b should be 23:", x[1].b);
26     stdout->show("x.c should be -1:", x[1].c);
27     stdout->show("x.d should be 18446744073709551615:", x[1].d);
28
29     return(0);
30 }