On Wednesday, 26 September 2012 at 12:29:38 UTC, Iain Buclaw wrote:
On 26 September 2012 13:07, monarch_dodra <[email protected]> wrote:
I don't see how the "extern(C)" is involved here, since it is the D compiler that first evaluates A(), B() and C() before passing the making the C
function call. Or did I miss something?


There is no physical code generation from the frontend that says
"evaluate this". What it passes to be backend for this operation is a
function call. So the backend determines the order of evaluation
depending on the order of parameters.

I'm not quite sure what you are trying to say here; I guess it depends on the definition of "backend". monarch_dodra is right in so far as the effects of "extern(C)" are an implementation detail coming from the particular way your compiler "glue code" is written; there is no fundamental reason why it should be important for parameter evaluation at all.

Speaking of it, what is the reason that the actual order of formal parameters (in terms of register allocation/stack layout) is reversed in the D calling convention, compared to extern (C) (e.g. on *nix x86_64)?

David

Reply via email to