Mercurial > projects > ldc
annotate tests/mini/staticarrays.d @ 984:4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Added it to .hgignore.
This gets rid of spurious differences caused by CMake regenerating it differently.
Just run 'cmake .' to get it back in your local checkout.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 19 Feb 2009 13:50:05 +0100 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
270
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
1
diff
changeset
|
1 extern(C) int printf(char*, ...); |
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
1
diff
changeset
|
2 |
1 | 3 void numbers() |
4 { | |
5 bool[8] bools; | |
6 char[8] chars; | |
7 byte[8] bytes; | |
8 short[8] shorts; | |
9 int[8] ints; | |
10 long[8] longs; | |
11 float[8] floats; | |
12 double[8] doubles; | |
13 real[8] reals; | |
14 { | |
15 bools[7] = true; | |
16 floats[7] = 3.14159265; | |
17 { | |
18 printf("bools[0] = %d, bools[7] = %d\n", bools[0], bools[7]); | |
19 printf("floats[0] = %f, floats[7] = %f\n", floats[0], floats[7]); | |
20 } | |
21 } | |
22 } | |
23 | |
24 struct S | |
25 { | |
26 int i = 42; | |
27 void print() | |
28 { | |
29 printf("S.i = %d\n", i); | |
30 } | |
31 } | |
32 | |
33 class C | |
34 { | |
35 int i; | |
36 this() | |
37 { | |
38 i = 3; | |
39 } | |
40 void print() | |
41 { | |
42 printf("C.i = %d\n", i); | |
43 } | |
44 } | |
45 | |
46 void refs() | |
47 { | |
48 void*[5] voids; | |
49 S*[5] structs; | |
50 C[5] classes; | |
51 | |
52 { | |
53 voids[0] = cast(void*)0xA; | |
54 printf("void* = %p\n", voids[0]); | |
55 } | |
56 { | |
57 structs[0] = new S; | |
58 structs[0].print(); | |
59 delete structs[0]; | |
60 } | |
61 { | |
62 classes[0] = new C; | |
63 classes[0].print(); | |
64 delete classes[0]; | |
65 } | |
66 } | |
67 | |
339
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
270
diff
changeset
|
68 void vals() |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
270
diff
changeset
|
69 { |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
270
diff
changeset
|
70 S[5] structs; |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
270
diff
changeset
|
71 } |
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
270
diff
changeset
|
72 |
1 | 73 void main() |
74 { | |
75 numbers(); | |
76 refs(); | |
339
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
270
diff
changeset
|
77 vals(); |
1 | 78 } |