D calling convention

Jason House jason.james.house at gmail.com
Tue Oct 28 15:27:05 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.

It's sounding like right-to-left makes more sense than left-to-right.  As an English speaker, left-to-right seems more natural, but I see no reason to require it.  Beyond that, do we really want to require an evaluation order of arguments?  I'd much prefer for the compiler to work its optimization magic than have a set order anyway.



More information about the Digitalmars-d mailing list