We should deprecate -release

Dukc ajieskola at gmail.com
Sun Jul 14 19:23:20 UTC 2024


Steven Schveighoffer kirjoitti 13.7.2024 klo 4.55:
> The `-release` flag is equivalent to `-O -boundscheck=safeonly -inline`.
> 
> I think we should remove it. If you want no bounds checks, you should 
> have to really want it enough to type that whole monstrosity in. It's 
> trivial to avoid bounds checks by using `.ptr[index]` in `@system` code. 
> In my dub projects, I rewrite the release mode to keep bounds checks for 
> all code, it's that important.
> 
> What do you think? Deprecate for 3 versions, then remove.
> 
> -Steve

Agree. `@safe` ought to mean no undefined behaviour absent compiler bugs 
or `@trusted` abuse, that should be the default even in release mode.

For the same reason, I also think `-release` shouldn't imply 
`-check=assert=off`, as long as the spec says that is undefined 
behaviour (and dmd doesn't explicitly guarantee not optimising based on 
that).

Maybe I'd go with a longer deprecation period though, like ten releases 
or so.


More information about the Digitalmars-d mailing list