The case for integer overflow checks?

Ola Fosheim Grøstad ola.fosheim.grostad+dlang at gmail.com
Wed Sep 20 16:40:43 UTC 2017


On Wednesday, 20 September 2017 at 10:01:14 UTC, Kagamin wrote:
> On Monday, 18 September 2017 at 17:46:52 UTC, Ola Fosheim 
> Grøstad wrote:
>> No, I don't believe they do, as unsigned integers are modular 
>> in C/C++.
>
> So you can't check third party code because it pervasively uses 
> unsigned integers for lengths, sizes and everything else, 
> obvious example: 
> https://fossies.org/dox/libpng-1.6.32/structpng__info__def.html

For more complex third party code you have to vet it anyway for 
bad practices.

For utilitarian libraries it could be quite useful. So, it all 
depends.



More information about the Digitalmars-d mailing list