Vanquish Forever These Bugs That Blasted Your Kingdom

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Feb 7 20:30:54 UTC 2018


On Wednesday, 7 February 2018 at 13:29:04 UTC, Mike Parker wrote:
> Walter's got a new post up! It's the first in a new series on 
> the benefits of BetterC mode. In this one, he talks about 
> solving the fencepost problem (off-by-one errors) with D's 
> arrays.

While an enjoable read, I fear we are aiming too low.

Other languages like Rust or C# (or Java) have bounds check. Plus 
we probably lose it in release mode, which is the mode where 
lurking bugs are discovered usually days after development ;) 
Some of these languages would prevent it on the VM level/compiler 
level, leaving no way to shoot yourself in the foot.

If we have bounds checks by default it looks silly to have 
pointer arithmetic enabled by default. It’s like “we are safe 
from this problem, as long as you write code using this primitive 
not the other one”, which is basically safety by convention.



More information about the Digitalmars-d-announce mailing list