Boost logo

Boost Users :

Subject: Re: [Boost-users] [exception] What's wrong with boost::get_error_info?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-05-29 23:56:07

2009/5/29 Markus Schweiß <M.Schweiss_at_[hidden]>:
> Dear boost community,
> I'm really new to using the boost library. Whatever, the first part I want to use is boost::exception. But already there start my problems:
> I'm using 'boost::get_error_info<boost::throw_file>( myBoostException )' to retrieve the file name where my exception was thrown. The problem is that the returned 'const char*' pointer contains several wild characters at its end. It seems that the null-termination get lost somehow, somewhere.
> The same is with 'boost::throw_function' and the string returned by 'boost::diagnostic_information( myBoostException )'!
> For example, that is what I get from boost::diagnostic_information:
> ".\myFile.cppÍýýýý««««««««îþ(134): Throw in function MyClass::DoSomething()ÍÍÍÍÍÍ^ñ6
> Dynamic exception type: class MyBoostException"
> That's really strange because the strings are correctly stored to the boost::exception class attributes 'throw_function_' and 'throw_file_'.
> So what do I wrong???
> I would be so thankful when anyone could help me!
> Following some detailed information:
> - plattfrom:      Windows XP SP3
> - compiler:       MS VC++ 8
> - character set:  multi-byte
> - boost version:  Release 1.37.0
> code snippet for throwing my exception:
> throw MyBoostException() << boost::throw_file( __FILE__ )
>                         << boost::throw_line( __LINE__ )
>                         << boost::throw_function( "MyClass::DoSomething()" );
> code snippet for catching my exception:
> catch( MyBoostException& myBoostException ) {
>  std::string info = boost::diagnostic_information( myBoostException );
>  const char* string = info.c_str();
> }

Long shot, but it looks like you have ABI conflict of some sort. Could
you post a simple, complete program that demonstrates your problems?

Emil Dotchevski
Reverge Studios, Inc.

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