Quantcast

[conversion] lexical_cast doesn't throw

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[conversion] lexical_cast doesn't throw

Gaetano Mendola-3
Hi all,
I'm in the process to migrate our application from RedHat 5.5 (gcc 4.1.2) to Ubuntu
10.04 (gcc 4.4.3), one regression test is not passing due the fact that lexical_cast
is not throwing, this is the line:

   unsigned int myNumber = boost::lexical_cast<unsigned int>("-123");

I'm using boost 1.40 on both servers. I have noticed that the same executable
compiled on Ubuntu 10.04 while on Ubuntu doesn't throw, running it on RH 5.5 throws,
so it seems a system library problem.

Trying with a simple stringstream, it seems that with the following code:

std::stringstream myStream;
myStream << "-123";

unsigned int myUInt;
myStream >> myUInt;

doens't set the fail bit on Ubuntu 10.04, but it does on RedHat 5.5.

Does anyone have an idea on what is going on

Regards
Gaetano Mendola

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [conversion] lexical_cast doesn't throw

Rob Riggs
  On 08/04/2010 06:48 AM, Gaetano Mendola wrote:
> Hi all,
> I'm in the process to migrate our application from RedHat 5.5 (gcc 4.1.2) to Ubuntu
> 10.04 (gcc 4.4.3), one regression test is not passing due the fact that lexical_cast
> is not throwing, this is the line:
>
>     unsigned int myNumber = boost::lexical_cast<unsigned int>("-123");
>

https://bugzilla.redhat.com/show_bug.cgi?id=531919
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802

It appears that it was a change in the implementation of the num_put()
function in the GNU standard C++ library for GCC 4.4.

FWIW, the new behavior isn't what I want or expect from a lexical
conversion operator either.

Rob

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Loading...