Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 29 14:22:56 PDT 2014


On 10/29/2014 5:37 AM, Bruno Medeiros wrote:
> On 18/10/2014 18:40, Walter Bright wrote:
>> As I've said before, tripping an assert by definition means the program
>> has entered an unknown state. I don't believe it is possible for any
>> language to make guarantees beyond that point.
>
> The guarantees (if any), would not be made by the language, but by the
> programmer. The language cannot know if a program is totally broken and
> undefined when an assert fails, but a programmer can, for each particular
> assert, make some assumptions about which fault domains (like Sean put it) can
> be affected and which are not.

Assumptions are not guarantees.

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().



More information about the Digitalmars-d mailing list