Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1
Max Haughton
maxhaton at gmail.com
Sun Mar 21 07:51:45 UTC 2021
On Sunday, 21 March 2021 at 01:33:56 UTC, deadalnix wrote:
> On Sunday, 21 March 2021 at 00:18:43 UTC, Walter Bright wrote:
>> On 3/20/2021 8:12 AM, H. S. Teoh wrote:
>>> Is there a typo somewhere here? I'm *pretty* sure the
>>> current compiler
>>> *does* move structs in some cases, and that has caused
>>> problems in the
>>> past where structs that store pointers to themselves will end
>>> up with
>>> dangling pointers after, e.g., being returned from a function.
>>
>> It doesn't. Even in the case of NRVO, it doesn't actually move
>> them.
>>
>> The main reason it doesn't is because data flow analysis is
>> necessary to see if it can be moved (no pointers to the source
>> object). In order to determine "last use", DFA is used.
>
> idk for GDC, but LDC will, because LLVM will.
Godbolt example?
More information about the Digitalmars-d
mailing list