![]() |
Boost : |
From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-09-30 15:56:04
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, September 13, 2002 3:16 PM
Subject: Re: [boost] UBLAS_CHECK
> 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.
Where do I find throw_exception? I searched the 1.28.0 distribution and
found a definition in the lambda library only?
> Also, I agree that BOOST_UBLAS_CHECK should just assert (by default).
I noticed recent discussions regarding the question, whether preconditions
should assert. I'm still unsure.
> It's
> OK to provide a "throw exception" option, of course; even so, throwing an
> exception only in debug builds seems very odd.
This is not odd, if you're counting flops.
> 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.
I'll think about it.
Thanks
Joerg
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk