3 variant questions
Daniel Keep
daniel.keep.lists at gmail.com
Tue May 12 03:25:07 PDT 2009
Saaa wrote:
> I just noticed D1 does have std.stdarg.
> I shouldn't just search on the website :(
> (where it is missing on the phobos page)
>
>> import std.stdarg;
>>
>> assert( _arguments[0] is typeid(int*) );
>> auto arg = va_arg!(int*)(_argptr);
>> *arg = 10;
>>
>> Probably.
> :D
>> -- Daniel
>
> So, you make arg point to the same as va_arg.
No, va_arg is a function.
> Why is this extra step necessary and why won't simple casting not work?
You should never directly work with _argptr. It's not guaranteed to be
a simple pointer. For example, I believe that GCC will sometimes use
registers (God only knows WHY).
var_arg!(T) will convert _argptr into the type you specify and it will
also advance _argptr to the next argument.
-- Daniel
More information about the Digitalmars-d-learn
mailing list