libstdc++/3720: Problems with num_get

Peter Schmid schmid@snake.iap.physik.tu-darmstadt.de
Sat Dec 1 10:16:00 GMT 2001


The following reply was made to PR libstdc++/3720; it has been noted by GNATS.

From: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
To: bkoz@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
        philip_martin@ntlworld.com
Subject: Re: libstdc++/3720: Problems with num_get
Date: Sat, 1 Dec 2001 19:08:58 +0100 (CET)

 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
 



More information about the Gcc-prs mailing list