Mercurial > projects > ldc
comparison test/vararg2.d @ 57:a9d29e9f1fed trunk
[svn r61] Added support for D-style variadic functions :)
author | lindquist |
---|---|
date | Thu, 25 Oct 2007 02:39:53 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
56:3a784f7790d6 | 57:a9d29e9f1fed |
---|---|
1 module vararg2; | |
2 | |
3 void func(...) | |
4 { | |
5 assert(_arguments.length == 2); | |
6 assert(_arguments[0] is typeid(int)); | |
7 int a = *cast(int*)_argptr; | |
8 _argptr += int.sizeof; | |
9 assert(_arguments[1] is typeid(int)); | |
10 a += *cast(int*)_argptr; | |
11 _argptr += int.sizeof; | |
12 assert(a == 3); | |
13 } | |
14 | |
15 void main() | |
16 { | |
17 func(1,2); | |
18 } |