Is the following well defined and allowed?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Mar 2 18:21:39 UTC 2018


On Friday, March 02, 2018 11:25:00 Steven Schveighoffer via Digitalmars-d 
wrote:
> Yes, I think assertions should be kept in @safe code. It's weird to have
> array bounds checks kept, but not assertions (which is how you would do
> equivalent bounds checks in a custom type).

Then just don't compile with -release. I'd be a _lot_ less likely to use
assertions if I knew that the compiler was going to leave them in in release
mode. Assertions help find bugs, but they aren't doing anything to make the
code any more @safe unless some aspect of the compiler assuming that the
assertion is true when it's compiled out allows for the compiler to then
function in a manner that isn't @safe, which I doubt, but if it does, then
that needs to be fixed, not leaving in a bunch of extra checks intended for
catching bugs in development.

- Jonathan M Davis



More information about the Digitalmars-d mailing list