Boost logo

Boost :

Subject: Re: [boost] Boost and exceptions
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2012-06-24 19:14:10

On Sat, Jun 23, 2012 at 10:40 PM, Robert Ramey <ramey_at_[hidden]> wrote:

> If this is invoked at the exception site it works. If it is invoked
> anywhere else - like a rethrow it doesn't. It's totally non-intuitive
> and a trap for users. There is no mention of this in the documentation.

The danger of slicing in C++ is beyond the scope of any Boost library
documentation. That said, Boost Exception does protect the user from
slicing boost::exception objects.

> And I believe that a solution could have been crafted to avoid the issues
> that I've raised but that Emil doesn't agree that these concerns are
> legimate. I know steve doesn't agree with me on this either.

The concerns are legitimate, the disagreement is over the conclusion you've
reached. You're yet to back your beliefs with facts.

> So now I would have to provide a counter example which means
> basically re-doing the original work in the right way as I see it.

A lot of time got wasted in this discussion explaining why your ideas don't
work. Producing a working piece of code would be a welcome change, I think.

> > I may be
> > misunderstanding, but IIUC, the "problem" that he "fixed" was that his
> > change caused already-unsupported misuses of boost::throw_exception to
> > stop compiling. It's arguable that those misuses *should* be flagged
> > with compiler errors.
> the original boost::throw_exception was defined as:
> void throw_exception( std::exception const & e ); // user defined
> #else
> template<class E>
> void throw_exception(E const & e){
> throw(e);
> }
> #endif
> it's hard to see how one could even define "misuse" of this - much
> less detect it.

You should try to see it though. Several people have pointed it out.

Emil Dotchevski
Reverge Studios, Inc.

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