Walter Bright:

void f(ubyte[] a) @safe { assert(a.length>99); a[88] = a[77]; }

The compiler will insert array bounds checking for you.

But if your "assert" is the same as an assume(), then the optimizer should remove bounds checks (otherwise it's a lousy implementation of assume()) and leave no tests whatsoever inside the function f. So now you now have a safe function that is unsafe.

I think you are still missing the essential difference between assume and assert.

Bye,
bearophile

Reply via email to