Mercurial > projects > ldc
annotate test/arrays.d @ 108:288fe1029e1f trunk
[svn r112] Fixed 'case 1,2,3:' style case statements.
Fixed a bunch of bugs with return/break/continue in loops.
Fixed support for the DMDFE hidden implicit return value variable. This can be needed for some foreach statements where the loop body is converted to a nested delegate, but also possibly returns from the function.
Added std.math to phobos.
Added AA runtime support code, done ground work for implementing AAs.
Several other bugfixes.
author | lindquist |
---|---|
date | Tue, 20 Nov 2007 05:29:20 +0100 |
parents | c53b6e3fe49a |
children | c44e6a711885 |
rev | line source |
---|---|
1 | 1 void integer() |
2 { | |
3 auto arr = new int[16]; | |
4 arr[1] = 42; | |
5 arr[6] = 555; | |
6 print_int(arr); | |
7 delete arr; | |
8 } | |
9 | |
10 void floating() | |
11 { | |
12 auto arr = new float[6]; | |
13 arr[1] = 3.14159265; | |
14 arr[3] = 1.61803399; | |
15 print_float(arr); | |
16 delete arr; | |
17 } | |
18 | |
19 void print_int(int[] arr) | |
20 { | |
21 printf("arr[%lu] = [", arr.length); | |
22 for (auto i=0; i<arr.length; i++) | |
23 printf("%d,", arr[i]); | |
24 printf("\b]\n"); | |
25 } | |
26 | |
27 void print_float(float[] arr) | |
28 { | |
29 printf("arr[%lu] = [", arr.length); | |
30 for (auto i=0; i<arr.length; i++) | |
31 printf("%f,", arr[i]); | |
32 printf("\b]\n"); | |
33 } | |
34 | |
35 void main() | |
36 { | |
37 integer(); | |
38 floating(); | |
39 } |