Mercurial > projects > ldc
comparison tango/tango/core/Vararg.d @ 144:a27941d00351 trunk
[svn r149] fixed: a bunch of D-style variadics problems.
fixed: GotoDefaultStatement implemented.
fixed: some other minor bugs.
author | lindquist |
---|---|
date | Sat, 26 Jan 2008 17:13:22 +0100 |
parents | 1700239cab2e |
children | a9dae3da4e87 |
comparison
equal
deleted
inserted
replaced
143:336ec4f4bbb3 | 144:a27941d00351 |
---|---|
12 | 12 |
13 | 13 |
14 version( GNU ) | 14 version( GNU ) |
15 { | 15 { |
16 public import std.stdarg; | 16 public import std.stdarg; |
17 } | |
18 else version( LLVMDC ) | |
19 { | |
20 /** | |
21 * The base vararg list type. | |
22 */ | |
23 alias void* va_list; | |
24 | |
25 /** | |
26 * This function returns the next argument in the sequence referenced by | |
27 * the supplied argument pointer. The argument pointer will be adjusted | |
28 * to point to the next arggument in the sequence. | |
29 * | |
30 * Params: | |
31 * vp = The argument pointer. | |
32 * | |
33 * Returns: | |
34 * The next argument in the sequence. The result is undefined if vp | |
35 * does not point to a valid argument. | |
36 */ | |
37 T va_arg(T)(ref va_list vp) | |
38 { | |
39 size_t size = T.sizeof > size_t.sizeof ? size_t.sizeof : T.sizeof; | |
40 va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) & ~(size - 1)); | |
41 vp = vptmp + T.sizeof; | |
42 return *cast(T*)vptmp; | |
43 } | |
17 } | 44 } |
18 else | 45 else |
19 { | 46 { |
20 /** | 47 /** |
21 * The base vararg list type. | 48 * The base vararg list type. |