Boost logo

Boost Users :

Subject: Re: [Boost-users] Exceptions and throwing across module boundaries
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-11-11 19:06:40


On Wed, Nov 11, 2009 at 2:08 PM, Josh Faust <jfaust_at_[hidden]> wrote:
> we hit a case where an exception thrown in one
> module cannot be caught as anything but a std::exception in a module
> compiled with different settings (same compiler -- gcc 4.2).

The fact that catch(std::exception&) works for you is a coincidence.

> Since we'd prefer to use exceptions rather than return codes as our error
> reporting mechanism, I'm currently investigating possible solutions to
> this.  I was hoping to find something applicable boost, but it looks like
> boost doesn't differentiate between throwing in a header vs. throwing in a
> module -- for example, Boost.Thread has a few throw statements in cpp files
> Is this just an issue that hasn't been enough of a problem to address?

In general, a library might not work at all if its CPP files are
compiled with different settings than the user code, even if it didn't
throw any exceptions, because C and C++ do not define an ABI.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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