Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 1 18:09:15 PDT 2014


On 11/1/2014 4:14 AM, Kagamin wrote:
> On Wednesday, 29 October 2014 at 21:23:00 UTC, Walter Bright wrote:
>> In any case, if the programmer knows than assert error is restricted to a
>> particular domain, and is recoverable, and wants to recover from it, use
>> enforce(), not assert().
>
> But all that does is working around the assert's behavior to ignore cleanups.

It is not "working around" anything unless you're trying to use a screwdriver as 
a hammer. Cleanups are not appropriate after a program has entered an unknown state.



> Maybe, when it's known, that a failure is not restricted, some different way of
> failure reporting should be used?

assert() and enforce() both work as designed.


More information about the Digitalmars-d mailing list