"Daniel Keep" <[email protected]> wrote in message news:[email protected]... > > > 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. I meant to write _argptr :)
> >> 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). ok... > > var_arg!(T) will convert _argptr into the type you specify and it will > also advance _argptr to the next argument. What would happen if you'd cast it incorrectly if it wasn't a simple pointer ? :D > > -- Daniel
