Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/tango/tango/core/Vararg.d Fri Jan 25 01:42:36 2008 +0100 +++ b/tango/tango/core/Vararg.d Sat Jan 26 17:13:22 2008 +0100 @@ -15,6 +15,33 @@ { public import std.stdarg; } +else version( LLVMDC ) +{ + /** + * The base vararg list type. + */ + alias void* va_list; + + /** + * This function returns the next argument in the sequence referenced by + * the supplied argument pointer. The argument pointer will be adjusted + * to point to the next arggument in the sequence. + * + * Params: + * vp = The argument pointer. + * + * Returns: + * The next argument in the sequence. The result is undefined if vp + * does not point to a valid argument. + */ + T va_arg(T)(ref va_list vp) + { + size_t size = T.sizeof > size_t.sizeof ? size_t.sizeof : T.sizeof; + va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) & ~(size - 1)); + vp = vptmp + T.sizeof; + return *cast(T*)vptmp; + } +} else { /**