On Friday, 22 November 2019 at 03:42:26 UTC, dokutoku wrote:
Is there a difference in the execution speed and stability when executing the program by rewriting the parameter of the function argument like this?


```d
void test1 (int * X)
{
        // some processing
}

void test2 (ref int X)
{
        // some processing
}
```

The Compiler Explorer supports D, so it's a good way to
ask these questions.

https://godbolt.org/z/gnR6Eu

int example.test1(int*):
        mov     eax, DWORD PTR [rdi]
        imul    eax, eax
        add     eax, 1
        ret
int example.test2(ref int):
        mov     eax, DWORD PTR [rdi]
        imul    eax, eax
        add     eax, 1
        ret

Reply via email to