Boost logo

Boost Users :

Subject: Re: [Boost-users] boost exception question when threading library header is included.
From: Lars Viklund (zao_at_[hidden])
Date: 2011-06-10 02:37:15

On Thu, Jun 09, 2011 at 10:25:51PM -0800, Robert Ramey wrote:
> I am building a small ap to test the ASIO library. I run my test ap and
> things run as expected.
> But when I set my IDE options (MSVC 8.0) to trap when an exception is
> thrown, I get
> an exception thrown before main(.. is invoked. The call stack looks like:
> msvcr90d.dll!_CxxThrowException(void * pExceptionObject=0x0012fc3c, const
> _s__ThrowInfo * pThrowInfo=0x0047f944) Line 161 C++

Did you mean MSVC 9.0 (2008) above? Your symbols say it is.

> time_pair.exe!boost::copy_exception<boost::exception_detail::bad_alloc_>(const
> boost::exception_detail::bad_alloc_ & e={...}) Line 47 C++
> time_pair.exe!boost::exception_detail::get_bad_alloc<42>() Line 80 + 0x9f
> bytes C++
> time_pair.exe!`dynamic initializer for
> 'boost::exception_detail::exception_ptr_bad_alloc<42>::e''() Line 94 + 0x28
> bytes C++
> msvcr90d.dll!_initterm(void (void)* * pfbegin=0x004743c4, void (void)* *
> pfend=0x00474758) Line 903 C
> time_pair.exe!__tmainCRTStartup() Line 497 + 0xf bytes C
> time_pair.exe!mainCRTStartup() Line 399 C
> this seems to point an attempt to copy something non_copyable in the
> boost.exception library.
> Can anyone help me understand what's going on here and what I should do
> about it?

By "trap an exception", do you refer to some capability of breaking when
any exception is thrown or just uncaught ones?

Exceptions are part of normal C++ life, they do and will occur during
the natural execution of programs, no matter what your philosophy on
them are. If I configure the IDE to break whenever an exception is
thrown and caught, I'd never get anywhere.

Does this have any effects that you want to avoid? Do you want someone
to investigate why an exception is thrown in the first place?

I don't see anything immediately actionable here.

> Here is a small test which you can use to demonstrate the problem
> #include <boost/thread.hpp>
> int main(int argc, char * argv[]){
> return 0;
> }

Lars Viklund | zao_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at