If you needed any more evidence that memory safety is the future...

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 23 23:14:24 PST 2017


Jack Stouffer wrote:

> This is something that valgrind could have easily picked up, but the 
> devs just didn't use it for some reason. Runtime checking of this 
> stuff is important, so please, don't disable safety checks with DMD 
> if you're dealing with personal info.

or, even better: don't disable bounds checking at all. never.

if you are *absolutely* sure that bounds checking *IS* the bottleneck 
(you *did* used your profiler to find this out, did you?), you can 
selectively avoid bounds checking by using `arr.ptr[i]` instead of 
`arr[i]` (and yes, this is unsafe; but what would you expect by 
removing safety checks?).

forget about "-release" dmd arg. forget about "-boundscheck=off". no, 
really, they won't do you any good. after all, catching a bug in your 
program when it doesn't run in controlled environment is even more 
important than catching a bug in debugging session! don't hate your 
users by giving 'em software with all safety measures removed! please.


More information about the Digitalmars-d mailing list