checkedint call removal

Tobias Pankrath via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 2 06:32:33 PDT 2014


On Saturday, 2 August 2014 at 13:21:07 UTC, Artur Skawina via 
Digitalmars-d wrote:
> On 08/02/14 14:54, Tobias Pankrath via Digitalmars-d wrote:
>> I agree that this might hide bugs, but I don't agree that the 
>> additional trouble is bigger than the additional payoffs.
>
> The bug was _introduced_ by the assert, the code was 100% 
> correct.
>
If an assert fails, it's a bug in my book.

> Imagine working on a project with dozen+ developers that use 
> asserts
> extensively ("it never hurts to have more assertions"). If one 
> of them
> makes a simple mistake or forgets to update an assert expression
> somewhere, your own perfectly fine and safe code becomes buggy 
> and
> exploitable.

If there is a wrong assert in the code, it's not perfectly fine. 
To fail to update some if condition somewhere and to corrupt 
memory or to forget to fix an assert somewhere and to corrupt 
memory, are both bugs that will happend with the same likeihood.

The first will get you with disabled bound checks, the latter 
might get you with this optimization. I just don't see how I 
would take a stand, where I care about one but not about the 
other.


More information about the Digitalmars-d mailing list