Mercurial > projects > ldc
comparison tests/mini/vararg4.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/vararg4.d@895e1b50cf2a |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module vararg4; | |
2 import tango.core.Vararg; | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 void vafunc(...) | |
6 { | |
7 foreach(i,v; _arguments) { | |
8 if (typeid(byte) == v) { | |
9 printf("byte(%d)\n", va_arg!(byte)(_argptr)); | |
10 } | |
11 else if (typeid(short) == v) { | |
12 printf("short(%d)\n", va_arg!(short)(_argptr)); | |
13 } | |
14 else if (typeid(int) == v) { | |
15 printf("int(%d)\n", va_arg!(int)(_argptr)); | |
16 } | |
17 else if (typeid(long) == v) { | |
18 printf("long(%ld)\n", va_arg!(long)(_argptr)); | |
19 } | |
20 else if (typeid(float) == v) { | |
21 printf("float(%f)\n", va_arg!(float)(_argptr)); | |
22 } | |
23 else if (typeid(double) == v) { | |
24 printf("double(%f)\n", va_arg!(double)(_argptr)); | |
25 } | |
26 else if (typeid(real) == v) { | |
27 printf("real(%f)\n", va_arg!(real)(_argptr)); | |
28 } | |
29 else | |
30 assert(0, "unsupported type"); | |
31 } | |
32 } | |
33 | |
34 void main() | |
35 { | |
36 vafunc(byte.max,short.max,1,2,3,4L,5.0f,6.0,cast(real)7); | |
37 } |