DIP 1028---Make @safe the Default---Community Review Round 1

Timon Gehr timon.gehr at gmx.ch
Thu Jan 9 19:59:44 UTC 2020


On 09.01.20 20:09, Arine wrote:
> 
> @safe void someFunction()
> {
>      int[2] data;
>      // Lot's of code
>      @unsafe
>      {
>          static assert( data.length > 3 );
>          data.ptr[3] = 42;
>      }
> }

@safe void someFunction(){
     static struct Nope{
         int[2] payload;
         alias payload this;
         enum length=1337;
     }
     Nope data;
     // ...
     @unsafe{
         static assert(data.length>3);
         data.ptr[3] = 42;
     }
}


More information about the Digitalmars-d mailing list