Advice needed: Fixing intrinsics signatures for those that unduely take aligned vectors ?

Steven Schveighoffer schveiguy at gmail.com
Sat Jan 2 00:17:23 UTC 2021


On 1/1/21 4:22 PM, Ola Fosheim Grøstad wrote:
> On Friday, 1 January 2021 at 21:11:09 UTC, Ola Fosheim Grøstad wrote:
>> On Friday, 1 January 2021 at 21:07:10 UTC, Steven Schveighoffer wrote:
>>> Yes, something that terminates the program immediately is still safe 
>>> in D's eyes. @safe is not looking to fix all bugs, just memory safety 
>>> problems.
>>
>> But shouldn't reading out of bounds be safe too, or?
> 
> Well, it obviously isn't. What I meant is that maybe it would be better 
> to relax the requirements for reads in final builds since you have many 
> reads and writes are more destructive. Just a thought.
> 

foo(int*[] somearr)
{
   auto badptr = somearr[somearr.length]; // read happens here, what 
could go wrong?
   *badptr = 5; // oops
}

-Steve


More information about the Digitalmars-d mailing list