Mercurial > projects > ldc
annotate tests/mini/alloca1.d @ 1651:cb960b882ca3 tip
bindings were moved to dsource.org/projects/bindings/
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Thu, 20 May 2010 20:05:03 +0200 |
parents | 44f08170f4ef |
children |
rev | line source |
---|---|
lindquist@94 | 1 module alloca1; |
lindquist@94 | 2 |
tomas@443 | 3 pragma(alloca) void* alloca(uint); |
lindquist@94 | 4 |
lindquist@270 | 5 extern(C) int printf(char*, ...); |
lindquist@270 | 6 |
lindquist@94 | 7 void main() |
lindquist@94 | 8 { |
lindquist@94 | 9 int n = 16; |
lindquist@94 | 10 int* p = cast(int*)alloca(n*int.sizeof); |
lindquist@94 | 11 int[] a = p[0..n]; |
lindquist@94 | 12 a[] = 0; |
lindquist@94 | 13 foreach(i,v; a) { |
lindquist@94 | 14 printf("a[%2d] = %d\n", i, v); |
lindquist@94 | 15 } |
lindquist@94 | 16 } |