Make using compiled libs with debug code better

rikki cattermole rikki at cattermole.co.nz
Mon Oct 18 23:29:09 UTC 2021


On 19/10/2021 12:17 PM, Paul Backus wrote:
> 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.

That isn't radical at all.

"I believe that range checking should be used far more often than it 
currently is, but not everywhere. On the other hand I am really assuming 
infallible hardware when I say this; surely I wouldn't want to remove 
the parity check mechanism from the hardware, even under a hypothetical 
assumption that it was slowing down the computation. Additional memory 
protection is necessary to prevent my program from harming someone 
else's, and theirs from clobbering mine. My arguments are directed 
towards compiled-in tests, not towards the hardware mechanisms which are 
really needed to ensure reliability." - 1974 Structured Programming with 
go to Statements - Donald Knuth.

In context having the default be sanity checks turned on, is probably 
the right way to go.


More information about the Digitalmars-d mailing list