Make using compiled libs with debug code better
Paul Backus
snarwin at gmail.com
Mon Oct 18 23:17:52 UTC 2021
On Monday, 18 October 2021 at 13:04:47 UTC, Steven Schveighoffer
wrote:
> Would it be a reasonable thing to change contracts to be called
> by the caller instead of the callee? Is that something that
> could make its way into D, such that the input checking of
> functions that are compiled for release still can run when you
> compile your code in non-release mode?
My radical idea (which I also brought up on Discord) is that we
should enable *all* contract checks and asserts in release mode
by default, and tell programmers to use `debug assert(...)` if
they want a particular check to be removed in release builds.
Of course, if you really wanted to disable contract checks or
assertions at build time, you would still be able to do so with
`-check=assert=off` and `-check=[in|out|invariant]=off`. But
requiring an explicit opt-in would make this much less of a
footgun than it currently is.
More information about the Digitalmars-d
mailing list