pointer escaping return scope bug?

Tejas notrealemail at gmail.com
Sat Nov 26 01:55:49 UTC 2022


On Friday, 25 November 2022 at 17:45:57 UTC, Paul Backus wrote:
> On Friday, 25 November 2022 at 14:07:28 UTC, ShadoLight wrote:
>> On Saturday, 19 November 2022 at 15:00:16 UTC, Paul Backus 
>> wrote:
>>> Since, in your example, `lf` has global lifetime, the 
>>> compiler deduces that `lf.fp` also has global lifetime, and 
>>> therefore there is nothing wrong with assigning it to `p`.
>>
>> I follow your rationale, but for the life of me I cannot see 
>> how `lf` _"has global lifetime"_.
>
> You're right, my terminology here is sloppy. I'm really talking 
> about the memory pointed to by `lf`, not `lf` itself, so I 
> should really say that `lf` *points to memory* with global 
> lifetime (or perhaps "`*lf` has global lifetime").

Time to use separation logic

# 😈


More information about the Digitalmars-d-learn mailing list