Mercurial > projects > ldc
annotate test/arrays15.d @ 305:2b72433d5c8c trunk
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
Fixed problems with label collisions when using labels inside inline asm. LabelStatement is now easily reached given its
Identifier, which should be useful elsewhere too.
Enabled inline asm for building the lib/compiler/llvmdc runtime code, fixing branches out of asm makes this possible.
author | lindquist |
---|---|
date | Fri, 27 Jun 2008 22:04:35 +0200 |
parents | test/arrays.d@e881c9b1c738 |
children | 0baca2feb554 |
rev | line source |
---|---|
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
175
diff
changeset
|
1 module arrays; |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
175
diff
changeset
|
2 |
175
c44e6a711885
[svn r191] Fixed: array literals did not support all type/storage combinations.
lindquist
parents:
1
diff
changeset
|
3 extern(C) int printf(char*, ...); |
c44e6a711885
[svn r191] Fixed: array literals did not support all type/storage combinations.
lindquist
parents:
1
diff
changeset
|
4 |
1 | 5 void integer() |
6 { | |
7 auto arr = new int[16]; | |
8 arr[1] = 42; | |
9 arr[6] = 555; | |
10 print_int(arr); | |
11 delete arr; | |
12 } | |
13 | |
14 void floating() | |
15 { | |
16 auto arr = new float[6]; | |
17 arr[1] = 3.14159265; | |
18 arr[3] = 1.61803399; | |
19 print_float(arr); | |
20 delete arr; | |
21 } | |
22 | |
23 void print_int(int[] arr) | |
24 { | |
25 printf("arr[%lu] = [", arr.length); | |
26 for (auto i=0; i<arr.length; i++) | |
27 printf("%d,", arr[i]); | |
28 printf("\b]\n"); | |
29 } | |
30 | |
31 void print_float(float[] arr) | |
32 { | |
33 printf("arr[%lu] = [", arr.length); | |
34 for (auto i=0; i<arr.length; i++) | |
35 printf("%f,", arr[i]); | |
36 printf("\b]\n"); | |
37 } | |
38 | |
39 void main() | |
40 { | |
41 integer(); | |
42 floating(); | |
43 } |