Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-01-03 03:46:28


"Dan W." <danw_at_[hidden]> wrote in message
news:bt5sc7$qjd$1_at_sea.gmane.org...
> >>Precisely, the DBC
> >>'fuses' are only compiled in debug mode because you don't want to stop
> >>the application out there in the real world.
> > Often it is better to terminate() than letting a program continue on
> > undefined behavior; especially in
> > languages with unsafe pointers.
>
> That's what I've been saying all along. OFTEN, but not always. That's
> why you want to use exceptions, and have a *policy*. And preferably a
> run-time customizable policy.
>
> But I've also been saying, DBC has only one policy: to stop execution.
> And the intent for DBC is to help debug as well as document. It is not
> meant to replace exceptions.
>
> Using exceptions for debugging sucks. Exceptions are good at dealing
> with exceptions in the field, not with bugs.
>
> DBC is for dealing with bugs, NOT with exceptions in the field.
>
> That's why I've been saying _please_forget_exceptions_ when talking
> about implementing DBC. Just leave them alone. Let's just talk DBC.
> Which is for dealing with bugs.

Other people disagree:

http://www.digitalmars.com/ctg/designbycontract.html

Quote:

"Currently, contracts rely on the assert() macro aborting the program with a
message. Perhaps this needs to be revisited, and changed to throw an
exception instead. "

http://archive.eiffel.com/doc/manuals/technology/contract/

Quote:

"The benefits of Design by Contract include the following: [...] A technique
for dealing with abnormal cases, leading to a safe and effective language
construct for exception handling."

You will also see that the invariant is kept in the short form.

br

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk