Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Mika Heiskanen (mika.heiskanen_at_[hidden])
Date: 2008-12-21 08:35:02


Peter Simons wrote:

Hello Peter,

> Hi Mika,
>
> > I would prefer my word processor to announce a programming error
> > instead of producing a core dump. Am I missing some finer point on
> > the nature of invariants?
>
> apparently, you expect invariants to fail. They won't. Invariants never,
> ever fail. They are invariant. These assumptions are the cornerstones on
> which your algorithms are built. Adding code that throws an exception in
> case of an invariant failure is wasted, because that exception will never
> be thrown.

No, I do not except them to fail. However, it is possible that they fail
due to programming errors, and I would be naive to assume none would make
it to release versions. For example, I cannot let my server crash
if it cannot fulfill a particular type of request due to a programming error.
Instead it should log the error and fail that particular request. Clearly
the matter should have been resolved in advance by sufficient testing, but
is any amount of testing really ever sufficient?

I guess the problem is that I believe invariant failures may be recoverable,
but it does not seem to be the concensus. Perhaps I am thinking too much
about servers which must not crash.

Kind Regards,

--> Mika Heiskanen


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net