What ever happened to move semantics?
Dukc
ajieskola at gmail.com
Thu Feb 29 11:03:00 UTC 2024
On Thursday, 29 February 2024 at 04:17:38 UTC, Walter Bright
wrote:
> DFA works with mathematical reliability (absent compiler bugs).
> The optimizer relies heavily on DFA; if DFA was unreliable the
> whole edifice will fall apart. Leave move vs copy to the
> compiler. The move vs copy/destroy choice is an optimization,
> and should be semantically thought of it that way.
I'm a bit worried this would lead to implementation-defined
behaviour on whether uses of a struct with a disabled copy
constructor would compile.
But otherwise I agree with this. Well, the spec currently doesn't
allow these elision in all cases, for example it says:
```D
struct A
{
this(ref return scope A another) {}
}
void fun(A a) {}
void main()
{
A a;
fun(a); // copy constructor gets called
}
```
...but I tend to agree it should be implementation-defined
whether the copy constructor is called here.
More information about the Digitalmars-d
mailing list