On 7/30/14, 3:41 PM, David Nadlinger wrote:
On Wednesday, 30 July 2014 at 22:30:59 UTC, Walter Bright wrote:
On 7/30/2014 3:20 PM, Artur Skawina via Digitalmars-d wrote:
void f(ubyte[] a) @safe { assert(a.length>99); a[88] = a[77]; }
The compiler will insert array bounds checking for you.
Trying to understand what your position is: In release mode, but with
bounds checking enabled, would the compiler
a) be allowed to replace this with a RangeError or, say, ud2 or
another halt()-type instruction?
b) treat any call to f() as undefined behavior?
I think that's a good example. My understanding (I know it wasn't me who
was asked...): the presence of assert should not influence the
introduction of bounds checks.
Andrei