April 09, 2014
According to this issue: https://issues.dlang.org/show_bug.cgi?id=12550

-release disables bounds checking on non-@safe code? Is this correct?

If the above is true and apart from removing asserts what else does -release do?
April 09, 2014
On Wednesday, 9 April 2014 at 08:22:20 UTC, Gary Willoughby wrote:
> According to this issue: https://issues.dlang.org/show_bug.cgi?id=12550
>
> -release disables bounds checking on non-@safe code? Is this correct?

Correct.

> If the above is true and apart from removing asserts what else does -release do?

release means:
assert/preconditions/invariants are stripped from everything.
bounds checking in @system [*] code is removed.

That's it. (AFAIK). It doesn't actually optimize your code or anything.

The option "-noboundscheck" can be used to deactivate bounds checking altogether, in either @safe code, or simply all code in non-release.

[*] An interesting "hack" is that @trusted code is considered "system code that can be used in safe code".

As such, if you need safe code that runs fast, you can mark it as @trusted instead. This will deactivate *its* bounds checking, without affecting the otherwise global bounds checking configurations.

There's another hack to mark your code as trusted, and use "slice.ptr[index]" to bypass bounds checking altogether. Use with caution :D !