On Wednesday, 12 April 2017 at 12:52:42 UTC, Timon Gehr wrote:
On 12.04.2017 13:25, Mike Parker wrote:
DIP 1006 is titled "Providing more selective control over
contracts".
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1006.md
All review-related feedback on and discussion of the DIP
should occur in
this thread. The review period will end at 11:59 PM ET on
April 26 (3:59
AM GMT), or when I make a post declaring it complete.
At the end of Round 1, if further review is deemed necessary,
the DIP
will be scheduled for another round. Otherwise, it will be
queued for
the formal review and evaluation by the language authors.
Thanks in advance to all who participate.
Destroy!
The DIP should probably specify in detail how this interacts
with -release.
I guess the difference between "-contracts=none
-boundscheck=safeonly" and" -release" is that failing
assertions are UB only with the latter?
What happens if I pass both -contracts=none and -release?
Addressing Daniel Kozak's question as well here:
Providing `-release` on the command line has the following effect:
- Disable invariants,
- Disable in and out,
- Disable assert,
- Disable switch error [1]
Which `-contract` just allows more control on.
TL;DR: It affects all build. It's a subset of `-release`, so
passing `-contracts=whatever` and `-release` has the same effect
as passing `-release`.
[1] Switch error: Compiler code here:
https://github.com/dlang/dmd/blob/0158d32fcbbdda16b3f79e73f2f1f8c13afb9f6d/src/ddmd/statementsem.d#L2120-L2145
When a `switch has no `default,` in debug it'll insert a
`default` which throws a `core.exception : SwitchError`, and in
release the generated `default` will just be an `HLT` (same as
`assert(0)`).