From mboxrd@z Thu Jan 1 00:00:00 1970 From: bkoz@gcc.gnu.org To: bkoz@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: libstdc++/2634 Date: Wed, 02 May 2001 12:26:00 -0000 Message-id: <20010502192601.28037.qmail@sourceware.cygnus.com> X-SW-Source: 2001-05/msg00060.html List-Id: The following reply was made to PR libstdc++/2634; it has been noted by GNATS. From: bkoz@gcc.gnu.org To: andras.aszodi@pharma.novartis.com, bkoz@gcc.gnu.org, dirk.steenpass@pharma.novartis.com, gcc-gnats@gcc.gnu.org Cc: Subject: Re: libstdc++/2634 Date: 2 May 2001 19:25:18 -0000 Synopsis: istrstream state not correct upon failed conversion State-Changed-From-To: feedback->closed State-Changed-By: bkoz State-Changed-When: Wed May 2 12:25:18 2001 State-Changed-Why: This code works as expected under current CVS, giving me: %a.out i3333333.32 -> X n3333333.32 -> X I've ported your code to the new c++ library, the code I used is as below: // libstdc++/2634 // Try to convert strings starting with 'i' or 'n' to double, you won't get // the 'X' you should get. #include #include int main(void) { using namespace std; istringstream istrs01("i3333333.32"); istringstream istrs02("n3333333.32"); // DBL_MAX is printed if conversion fails but stream state remains good. double Tdouble = DBL_MAX; if ( istrs01 >> Tdouble) cout << istrs01.str() <<" -> " << Tdouble << endl; else cout << istrs01.str() <<" -> X"<> Tdouble) cout << istrs02.str() <<" -> " << Tdouble << endl; else cout << istrs02.str() <<" -> X"<