digitalmars.D - DIP-1000 and slice lifetimes
- =?UTF-8?B?Tm9yZGzDtnc=?= (9/9) Dec 16 2016 Will DIP-1000 correctly forbid code such as
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/3) Dec 16 2016 If code reside in a @safe function, that is.
- Walter Bright (13/21) Dec 16 2016 ----
- =?UTF-8?B?Tm9yZGzDtnc=?= (3/29) Dec 16 2016 Awesome! Your PR has been pending for quite some time. Im eagerly
- Walter Bright (2/4) Dec 16 2016 So am I!
- =?UTF-8?B?Tm9yZGzDtnc=?= (3/4) Dec 16 2016 I wish I could help out, but I feel like I'm too unskilled in DMD
Will DIP-1000 correctly forbid code such as
     int[] xs;
     {
         int[3] x = [1, 2, 3];
         xs = x[]; // leaks dangling pointer `xs.ptr` to enclosing 
scope
     }
     xs[] = 0; // undefined behaviour
from compiling?
 Dec 16 2016
On Friday, 16 December 2016 at 12:37:56 UTC, Nordlöw wrote:Will DIP-1000 correctly forbid code such as...If code reside in a safe function, that is.
 Dec 16 2016
On 12/16/2016 4:37 AM, Nordlöw wrote:
 Will DIP-1000 correctly forbid code such as
     int[] xs;
     {
         int[3] x = [1, 2, 3];
         xs = x[]; // leaks dangling pointer `xs.ptr` to enclosing scope
     }
     xs[] = 0; // undefined behaviour
 from compiling?
----
 safe void foo()
{
     int[] xs;
     {
         int[3] x = [1, 2, 3];
         xs = x[]; // leaks dangling pointer `xs.ptr` to enclosing scope
     }
     xs[] = 0; // undefined behaviour
}
----
test.d(6): Error: address of variable x assigned to xs with longer lifetime
 Dec 16 2016
On Friday, 16 December 2016 at 13:30:47 UTC, Walter Bright wrote:On 12/16/2016 4:37 AM, Nordlöw wrote:Awesome! Your PR has been pending for quite some time. Im eagerly waiting for it to be reviewed and merged. 😊Will DIP-1000 correctly forbid code such as int[] xs; { int[3] x = [1, 2, 3]; xs = x[]; // leaks dangling pointer `xs.ptr` to enclosing scope } xs[] = 0; // undefined behaviour from compiling?---- safe void foo() { int[] xs; { int[3] x = [1, 2, 3]; xs = x[]; // leaks dangling pointer `xs.ptr` to enclosing scope } xs[] = 0; // undefined behaviour } ---- test.d(6): Error: address of variable x assigned to xs with longer lifetime
 Dec 16 2016
On 12/16/2016 6:36 AM, Nordlöw wrote:Awesome! Your PR has been pending for quite some time. Im eagerly waiting for it to be reviewed and merged. 😊So am I!
 Dec 16 2016
On Friday, 16 December 2016 at 16:08:02 UTC, Walter Bright wrote:So am I!I wish I could help out, but I feel like I'm too unskilled in DMD internals to help out in the review.
 Dec 16 2016








 
  
  
 
 =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com>
 =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> 