What ever happened to move semantics?

Atila Neves atila.neves at gmail.com
Thu Feb 29 10:10:30 UTC 2024


On Thursday, 29 February 2024 at 04:17:38 UTC, Walter Bright 
wrote:
> On 2/28/2024 1:03 PM, Timon Gehr wrote:
>> No, the idea is that the compiler enforces that it is indeed 
>> the last use and produces a compile-time error message if it 
>> cannot prove that it is the case.
>
> 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.

Not always. Some types have to be move-only.



More information about the Digitalmars-d mailing list