D calling convention

Tomas Lindquist Olsen tomas at famolsen.dk
Tue Oct 28 14:12:04 PDT 2008


Walter Bright wrote:
> Christian Kamm wrote:
>> One point we couldn't understand though, is the reversal of parameters 
>> when
>> calling some D functions: Parameters are usually passed right-to-left,
>> except for nonvariadic D functions, where the order changes to
>> left-to-right.
>> What is the reason for it?
> 
> The reason is because I'd eventually like to specify the order of 
> evaluation of function arguments as being left to right. So, for normal 
> D functions, this makes for optimal code generation. The only time 
> monkey business would have to happen would be to support the C calling 
> convention or the variadic one.

What do you think of the "proposal"?, I think it could be quite valuable and the current setup 
makes has some odd behaviour.

Take the TypeInfo_Struct.xopCmp for example. Here a member function pointer is assigned to a 
static function pointer, the result being that you have to call it with parameters reversed for 
things to work as you expect, but only when x86 ABI is in effect.



More information about the Digitalmars-d mailing list