D perfomance

Timon Gehr timon.gehr at gmx.ch
Sun Apr 26 07:45:03 UTC 2020


On 26.04.20 04:22, Walter Bright wrote:
> On 4/25/2020 4:00 PM, Timon Gehr wrote:
>> What's an example of such an optimization and why won't it introduce 
>> UB to @safe code?
> 
>      @live void test() { int a,b; foo(a, b); }
> 
>      @live int foo(ref int a, ref int b) {
>          a = 0;
>          b = 1;
>          return a;
>      }
> 
> ref a and ref b cannot refer to the same memory object.

Actually they can, even in @safe @live code.


More information about the Digitalmars-d mailing list