On 07.03.2018 15:08, Paolo Invernizzi wrote:
On Wednesday, 7 March 2018 at 13:55:11 UTC, Jonathan M Davis wrote:
On Wednesday, March 07, 2018 13:24:19 Paolo Invernizzi via
Digitalmars-d wrote:
[...]
That would make assertions a lot worse to use, because then they would
be in production code slowing it down. Also, as it stands, -release is
not supposed to violate @safe. To do that, you have to use
-boundscheck=off to turn off bounsd checking. That was a very
purposeful design decision, because we did not want -release to
violate @safe, and if the compiler is allowed to add optimizations
which are unsafe based on assertions, then that completely destroys
the ability to have @safe code with -release. And if we were going to
do that, why did we leave array bounds checking on with -release?
[...]
Jonathan, I understand your point, but still I can't find an answer to
clarify my doubts.
Are we asking for no UB in @safe code?
Are we asking for UB in @safe code but constrained to no memory
corruptions?
/Paolo
UB is unconstrained by definition. If it is constrained, it is not UB.