Mercurial > projects > ldc
annotate test/arrays.d @ 131:5825d48b27d1 trunk
[svn r135] * Merged DMD 1.025 *
* Fixed a minor linking order mishap *
* Added an command line option -annotate *
* Fixed some problems with running optimizations *
* Added std.stdio and dependencies to lphobos (still not 100% working, but compiles and links) *
* Fixed problems with passing aggregate types to variadic functions *
* Added initial code towards full GC support, currently based on malloc and friends, not all the runtime calls the GC yet for memory *
* Fixed problems with resolving nested function context pointers for some heavily nested cases *
* Redid function argument passing + other minor code cleanups, still lots to do on this end... *
author | lindquist |
---|---|
date | Fri, 04 Jan 2008 01:38:42 +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 } |