checkedint call removal

Artur Skawina via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 30 15:53:38 PDT 2014


On 07/31/14 00:31, Walter Bright via Digitalmars-d wrote:
> On 7/30/2014 3:20 PM, Artur Skawina via Digitalmars-d wrote:
>> On 07/30/14 23:42, Walter Bright via Digitalmars-d wrote:
>>> @safe's promise is one of memory safety, not a promise of program correctness.
>>
>>     void f(ubyte[] a) @safe { assert(a.length>99); a[88] = a[77]; }
> 
> The compiler will insert array bounds checking for you.

No, with the assert definition you're proposing, it won't. It would
be allowed to optimize away the bounds check. And this is just one of
many problems with the assert==assume approach.

artur


More information about the Digitalmars-d mailing list