enforce()?

Simen kjaeraas simen.kjaras at gmail.com
Thu Jun 17 01:51:32 PDT 2010


Lutger <lutger.blijdestijn at gmail.com> wrote:

> Simen kjaeraas wrote:
>
> ...
>> If it cannot send the email, it may throw an Exception. If you try and
>> pass it a handwritten letter, it should throw an Error.
>>
>
> This is the question: should I segfault on a handwritten letter even if  
> it is
> not such an important letter and could just go on operating?

Yes. If someone is passing your email system a handwritten letter,
something is so wrong, the program should balk and exit. It's not just
a small mixup, it's an indication something is completely wrong.

As Walter put it, an Error, be it an AssertError or otherwise, means
your program has ventured into uncharted territory, and behavior from
this point on is undefined. "Permissible undefined behavior ranges
 from ignoring the situation completely with unpredictable results, to
having demons fly out of your nose."[1]


-- 
Simen

[1] http://groups.google.com/group/comp.std.c/msg/dfe1ef367547684b?pli=1


More information about the Digitalmars-d mailing list