Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-01-02 05:30:12

"Reece Dunn" <msclrhd_at_[hidden]> wrote in message
> Dan W. wrote:

> With C++ having exception support, surely the exception mechanism is a
> better way to deal with invariants that do not hold? This allows the
> code to react to the failure and report something readible to the user,
> like:
> invariant failure: cannot access a null pointer, in ...
> instead of something like:
> abnormal program termination

It really depends. Many embedded environments disables exception handling.

> Also, you need a compiler that supports the DBC extensions. The current
> thinking behind the new C++ standard is to adopt a minimal set of language
> extensions and a large number of library extensions (c.f. Bjarne
> et. al.). Having a library-based invariant mechanism (integrating into the
> exception handling mechanism) allows support for older compilers (GCC
> 2.95.x; VC6; etc) that do not implement C++0x features.

Having used psudo-style dbc for some time, I honestly think
language support in some form is the only way to go.

> >Design By Contract is such a wonderful concept, BTW, I used to program in
> >Eiffel, and there's nothing I miss more than its built-in DBC.
> I agree, DBC is a powerful concept. What I am trying to do is open up the
> discussion on how it should be implemented in C++.

FYI, I'm actually working on a proposal to add Design by Contract to C++. I
to get it ready within 3 months. I'll let you know when I have something
readable :-)



Boost list run by bdawes at, gregod at, cpdaniel at, john at