Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-13 08:16:25


From: "Kresimir Fresl" <fresl_at_[hidden]>
>
> Toon Knapen wrote:
>
> > the bounds checking mechanism throws an exception instead of performing
an
> > assert. But I have no clue how I can ask my debugger where the exception
was
> > thrown so I would prefer an assert() to be used. In the debugger, it's
then
> > easy to perform a stack_trace.
>
> Did you try to define BOOST_NO_EXCEPTIONS ?
>
> raise() functions of all exception classes in `ublas/exception.hpp'
> are defined as:
>
> virtual void raise () {
> #ifndef BOOST_NO_EXCEPTIONS
> throw *this;
> #else
> abort ();
> #endif
> }

This should probably just call boost::throw_exception(*this), allowing
BOOST_NO_EXCEPTIONS users to handle the exception.

Also, I agree that BOOST_UBLAS_CHECK should just assert (by default). It's
OK to provide a "throw exception" option, of course; even so, throwing an
exception only in debug builds seems very odd. The usual practice (for those
that embrace "logic error" exceptions - I don't) is to throw an exception in
release builds, and assert in debug builds.


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