Boost logo

Boost Users :

Subject: [Boost-users] [conversion] lexical_cast doesn't throw
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2010-08-04 07:15:35

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

Gaetano Mendola

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