On Saturday, November 21, 2015 18:28:49 BBaz via Digitalmars-d-learn wrote: > this is only an error if bounds checking is not turned on. If you > compile your example with DMD option "-boundscheck=off", nothing > happens, and the slice will be equal (here) to a[3..$];
It's a logic error regardless. It's just that the runtime won't report it if you turn off bounds checking - just like it won't throw AssertErrors if you turn assertions off. It's not that the error goes away. It's just that runtime stops checking for it. The purpose of turning off the checking is to improve performance at the risk of letting certain errors go uncaught, not to let you not care about such errors. And while it might be the case right now that you get an empty slice with the current implementation when bounds checking is turned off, there is no guarantee that that will be the case in the future. It's undefined behavior. - Jonathan M Davis
