assert vs enforce.

Adam D. Ruppe destructionator at gmail.com
Fri Dec 20 15:11:43 PST 2013


On Friday, 20 December 2013 at 23:08:32 UTC, TheFlyingFiddle 
wrote:
> When should i use enforce instead of assert?

Assert is for things that is completely controlled by your 
program. If an assert fails, it is something you, the programmer, 
can fix by changing the code.

enforce is for things that interact with the outside world at 
runtime. It might be fixable by the user, creating a file or 
something like that.


More information about the Digitalmars-d-learn mailing list