The case for integer overflow checks?

Guillaume Piolat via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 15 19:49:13 UTC 2017


On Friday, 15 September 2017 at 16:04:08 UTC, Neia Neutuladh 
wrote:
> The last solution that I can think of, specific to this type of 
> thing, is to use the result to allocate a bounds-checked array, 
> where the allocation function yields the appropriately sized 
> array. You'll get an array bounds error that may be inscrutable.

It's true that my example doesn't fail in the same way if eg.

    new ubyte[width * height]

was used.


More information about the Digitalmars-d mailing list