John Regehr on "Use of Assertions"

John Colvin john.loughran.colvin at gmail.com
Mon Sep 3 08:54:33 UTC 2018


On Monday, 3 September 2018 at 06:26:59 UTC, Jonathan M Davis 
wrote:
> Well, if that were the intention, then -release could not 
> remove assertions from @safe code. -release does not remove 
> bounds checking from @safe code. You have to use 
> -boundscheck=off to disable assertions in @safe code (which is 
> of course discouraged, since it makes the code not @safe). So, 
> if we were to decide that assertions had to be left in for code 
> to stay @safe, then we would have to start leaving them in in 
> @safe code when -release is used and only compile them out with 
> a new flag specifically for compiling out assertions in @safe 
> code. And that would have pretty far-reaching effects given 
> that it's very much understood right now that -release removes 
> assertions. And personally, I'd probably use assertions a lot 
> less if they were going to be left in with -release. So, while 
> I think that that's a better approach that allowing @system 
> optimizations in @safe code when assertions are removed, I 
> can't say that I think that it's a great idea - though the 
> folks who pretty much always want assertions enabled would 
> probably like it (though they can already just skip -release).
>
> - Jonathan M Davis

Yes, the command line interface needs to make it easy and obvious 
to do the right thing.


More information about the Digitalmars-d mailing list