
7 May
2007
7 May
'07
12:13 p.m.
Dean Michael Berris wrote:
Hi Everyone,
I've recently tried the following (inlined test) which isolates the problem I've encountered with boost::lexical_cast<int8_t>:
#include <iostream> #include <boost/lexical_cast.hpp>
int main(int argc, char * argv[]) { int8_t value; try { value = boost::lexical_cast<int8_t>("127"); } catch (std::exception & e) { std::cerr << e.what() << '\n'; } return 0; };
This is compiled with gcc 4.1.2 on Linux. Any idea why 127 wouldn't fit into an 8-bit signed integer? The defined range for signed 8 bit integers should be -127..+127 right?
-128..+127 in 2's complement, actually. Can confirm for 1.33.1 with GCC 4.1.1. Seems to be a bug. Sebastian Redl