checkedint call removal

Artur Skawina via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 2 07:11:22 PDT 2014


On 08/02/14 15:32, Tobias Pankrath via Digitalmars-d wrote:
> 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:
> If there is a wrong assert in the code, it's not perfectly fine. 

The code is perfectly fine in isolation. The bug have leaked from
some other subsystem or library. When you look at or audit this
code, everything seems fine and there appears to be no problem.

Of course such a program is buggy. This is about
a) how easy it is to get to the buggy state;
b) how hard it is to identify and find the bug;
c) the impact of such a bug.

`assume` introduces _user-defined_ conditions that trigger UB.

> 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.

@safe was supposed to protect from that.

artur



More information about the Digitalmars-d mailing list