D mentioned on Rust discussions site

Paulo Pinto pjmlp at progtools.org
Mon May 25 20:46:04 UTC 2020


On Monday, 25 May 2020 at 20:30:51 UTC, welkam wrote:
> On Monday, 25 May 2020 at 14:20:39 UTC, Paulo Pinto wrote:
>>
>> Apparently people writing high integrity kernels in languages 
>> like Ada/SPARK don't find bounds checking a nuisance.
> I looked at generated assembler if boundscheck=off did 
> something and found that in few places that I looked it did 
> nothing. Most array accesses happen in a foreach loop and 
> compiler is smart enough to remove those checks. I haven't done 
> thorough investigation but my guess is that array bounds checks 
> are left in places where you should have checks even if you 
> wrote that code in C.

Indeed, bounds checking elision has been a thing for ages in 
everything else other than C / C++ / Objective-C, and mostly when 
it doesn't work, it is considered a compiler bug that needs to be 
eventually fixed.




More information about the Digitalmars-d mailing list