@trusted assumptions about @safe code

Stefan Koch uplink.coder at googlemail.com
Wed May 27 12:52:48 UTC 2020


On Wednesday, 27 May 2020 at 12:48:46 UTC, Steven Schveighoffer 
wrote:
> On 5/27/20 2:36 AM, ag0aep6g wrote:
>>> [...]
's relying on is actually true:
>> [...]
>
> I think this is not the way to view it. @safe code still should 
> do what it's supposed to do. It's not any harder *or any 
> easier* to call @safe code.
>
> [...]



{
   const i = cast(ssize_t) indexof(x, E);
   if (i < 0 || i > x.dim)
   {
     // no luck.
   }
   else
   {
     index is in bounds so use it.
   }
}


More information about the Digitalmars-d mailing list