Mercurial > projects > ldc
annotate test/funcs.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 | d9d5d59873d8 |
rev | line source |
---|---|
1 | 1 void main() |
2 { | |
3 printf("Testing functions\n"); | |
4 int i = 5; | |
5 assert(a(i) == 110); | |
6 assert(i == 11); | |
7 | |
8 S s; | |
9 s.i = 5; | |
10 d(s); | |
11 assert(s.i == 5); | |
12 e(s); | |
13 assert(s.i == 6); | |
14 | |
15 printf(" SUCCESS\n"); | |
16 } | |
17 | |
18 int a(ref int i) | |
19 { | |
20 i*=2; | |
21 return b(i); | |
22 } | |
23 | |
24 int b(ref int i) | |
25 { | |
26 i++; | |
27 return c(i); | |
28 } | |
29 | |
30 int c(int i) | |
31 { | |
32 return i*10; | |
33 } | |
34 | |
35 struct S | |
36 { | |
37 int i; | |
38 } | |
39 | |
40 void d(S s) | |
41 { | |
42 s.i++; | |
43 } | |
44 | |
45 void e(ref S s) | |
46 { | |
47 s.i++; | |
48 } |