Mercurial > projects > ldc
view tests/mini/arrays15.d @ 657:c42173b3557b
Removed some checks for abstract llvm types that were too strict, a 'opaque* null' is a valid initializer... when structs in D can be just a forward reference.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 06 Oct 2008 14:37:00 +0200 |
parents | 1bb99290e03a |
children |
line wrap: on
line source
module arrays15; extern(C) int printf(char*, ...); void integer() { auto arr = new int[16]; arr[1] = 42; arr[6] = 555; print_int(arr); delete arr; } void floating() { auto arr = new float[6]; arr[1] = 3.14159265; arr[3] = 1.61803399; print_float(arr); delete arr; } void print_int(int[] arr) { printf("arr[%lu] = [", arr.length); for (auto i=0; i<arr.length; i++) printf("%d,", arr[i]); printf("\b]\n"); } void print_float(float[] arr) { printf("arr[%lu] = [", arr.length); for (auto i=0; i<arr.length; i++) printf("%f,", arr[i]); printf("\b]\n"); } void main() { integer(); floating(); }