Mercurial > projects > ldc
annotate tests/mini/arrays15.d @ 715:30b42a283c8e
Removed TypeOpaque from DMD.
Changed runtime functions taking opaque[] to void[].
Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[].
Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86.
Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing.
Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way...
Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8.
Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 14:55:33 +0200 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
306
0baca2feb554
[svn r327] Fixed some more MinGW32 issues. It's now very close to working.
lindquist
parents:
305
diff
changeset
|
1 module arrays15; |
0baca2feb554
[svn r327] Fixed some more MinGW32 issues. It's now very close to working.
lindquist
parents:
305
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 } |