Assert and undefined behavior
user1234
user1234 at 12.sp
Wed Oct 11 09:39:04 UTC 2017
On Wednesday, 11 October 2017 at 09:27:49 UTC, John Burton wrote:
> [...]
> I therefore feel like I ought to not use assert and should
> instead validate my assumptions with an if statement and a
> throw or exit or something.
Yes, that's the way of doing. assert() are just used to test the
program. the -release option in DMD disable all the assert()
(excepted assert(0) which is a bit special), so that in a release
version, only Throwable objects can be used after a failure
detected.
More information about the Digitalmars-d-learn
mailing list