Challenge: write a reference counted slice that works as much as possible like a built-in slice

Walter Bright newshound2 at digitalmars.com
Wed Dec 15 10:17:49 UTC 2021


On 12/14/2021 6:05 AM, Paul Backus wrote:
> If you can find a way to actually cause UB in @safe code, you should post it on 
> the bug tracker. However, this example does not qualify.

UB is not quite right. It's about memory unsafety. Another way to illustrate 
this is:

   import std.stdio;

   @safe void main() {
     int x = void;
     writeln(x);
   }

will print garbage, but it is not unsafe.


More information about the Digitalmars-d mailing list