From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-08-22 15:50:19
On Thu, 22 Aug 2002 21:40:00 +0200, Alberto Barbati
>In fact, one thing that striked me at first when studying lexical_cast is
>that with the current implementation, the expression:
>not only does not return the string "hello, world" but throws an
>exception because of the space. It's very counter-intuitive, IMHO.
This is not true, because in that case lexical_cast uses
BTW, you said that your question arose on the STLport forum. From what
I've seen that forum seems quite extinguished however: a few time ago
we reported a bug (actually it's the same bug repeated in more that
one function) that concerns extraction of integers from streams.
Nobody replied. Should we mail Boris directly?
For your information the problem is in the implementation of the
functions __get_integer in the file _num_get.c. To reproduce it try
// The value of str must be the
// string representation of 1+LONG_MAX.
// Change it for your machine if needed.
int main(int argc, char* argv)
using namespace std;
str << "2147483648"; // 1+LONG_MAX
str >> num;
cout << "fail()? " << boolalpha << (str.fail()) << '\n';
If you use 2+LONG_MAX instead then the stream is put in a failed
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk