_argptr woes

Daniel Keep daniel.keep.lists at gmail.com
Fri Mar 16 20:11:14 PDT 2007



Sean Kelly wrote:
> Frits van Bommel wrote:
>> kris wrote:
>>> The D spec says:
>>>
>>> "The implementiations of these variadic functions have a special
>>> local variable declared for them, _argptr, which is a void* pointer
>>> to the first of the variadic arguments. To access the arguments,
>>> _argptr must be cast to a pointer to the expected argument type"
>>>
>>>
>>> To me, this means that a D compiler must implement _argptr in these
>>> terms. Is that indeed the case, Walter? Or is my interpretation
>>> incorrect?
>>
>> That would seem to be what it means.
>> That would also seem to be a pretty big portability bug in the spec.
>> On amd64 definitely !is(va_list == void*) :P. (at least for current
>> GDC, GCC and any other compiler following
>> http://www.x86-64.org/documentation/abi.pdf)
> 
> Perhaps I'm being thick, but why in the world would a CPU spec need to
> contain parameter passing rules?  Or even stack frame information?  I
> can see an OS caring about stack frame, but parameter passing seems like
> it should be language-dependent.
> 
> 
> Sean

I imagine it's more a case of: "here's an ABI we came up with for our
new architecture--you don't have to use it, but wouldn't it be nice if
we all just got along?"

If nothing else, it gives everyone a common calling convention to
implement so that their language can do interop on that platform easily.

	-- Daniel

-- 
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list