-dip1000 and non-scope variables

RazvanN razvan.nitu1305 at gmail.com
Thu Feb 18 12:55:12 UTC 2021


On Thursday, 18 February 2021 at 11:30:03 UTC, Jacob Carlborg 
wrote:
> On Thursday, 18 February 2021 at 10:05:52 UTC, RazvanN wrote:
>
>> Normally, in @safe code you are not allowed to take the 
>> address of a local or a parameter, however, it seems that with 
>> -dip1000 that is allowed and the compiler tries to infer 
>> `scope`.
>
> Isn't that the whole point or at least a big part of DIP100 (or 
> was that @live)? It can track the pointers and knows that it's 
> safe if the pointer doesn't live longer than the local variable.
>
> --
> /Jacob Carlborg

The question is what is the difference between scope and 
non-scope pointers? I would assume that if you don't use scope at 
all, then the code should have the same behavior as it would if 
you did not use -dip1000.


More information about the Digitalmars-d mailing list