_argptr woes

Sean Kelly sean at f4.ca
Sat Mar 17 08:22:19 PDT 2007


Frits van Bommel wrote:
> Lars Ivar Igesund wrote:
>> If there is an actual win in having _argptr as a pointer as opposed to 
>> the
>> current behaviour, for instance the possibility to easily indexing 
>> into the
>> argument list, then there is a good reason to have it in the 
>> specification.
>>
>> It is possible that other ways to have this working can be devised, 
>> but not
>> being able to index into them portably, when they in any case need to 
>> be in
>> the correct order, seems to me to be silly.
> 
> I agree that indexing is important to have, especially given how Tango's 
> format strings work.
> However I don't think that justifies the language standard basically 
> requiring that va_list is a pointer, especially if it can't be portably 
> used without special standard library functions (i.e. va_arg and 
> friends) anyway.
> If on a given architecture a pointer happens to be the most efficient or 
> natural implementation, fine. But I think that decision should be up to 
> the compiler, not the language.

For what it's worth, I think the compiler could likely optimize many 
uses of register-based varargs down to single-instruction operations. 
Addressing is the only issue that's a problem.  However, it's a 
sufficiently large one that I'm not convinced that passing varargs via 
registers is truly a good idea.


Sean



More information about the Digitalmars-d mailing list