This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/3720: Problems with num_get
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- To: bkoz at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, philip_martin at ntlworld dot com
- Date: Sat, 1 Dec 2001 19:08:58 +0100 (CET)
- Subject: Re: libstdc++/3720: Problems with num_get
Dear Mr Kosnik,
your proposal is reasonable as far as I understand it.
STLport-4.5, the other libstdc++ implementation I have access to,
restricts the input field for integers to ten decimals, as
defined by the digits10 member, and sets the failbit if there are more
than ten digits on input.
Consider the following source code tcin.C
#include <iostream>
using namespace std;
int main()
{
cout<<"rdstate before reading from cin : "
<< cin.rdstate() << endl;
cout<<"good eof fail bad "
<< ios::goodbit << " "
<< ios::eofbit << " "
<< ios::failbit << " "
<< ios::badbit << endl;
int i;
cin >> i;
cout << "cin state: " << cin.rdstate() << endl;
cout << "i: " << i << endl;
}
./tcin
rdstate before reading from cin : 0
good eof fail bad 0 2 4 1
1234567890
cin state: 0
i: 1234567890
peter@kiste:~> !!
./tcin
rdstate before reading from cin : 0
good eof fail bad 0 2 4 1
12345678901
cin state: 4
i: 2147483647
Hope this helps,
Peter Schmid