C++ wrapper iostream input bug
Helmut Jarausch
jarausch at igpm.rwth-aachen.de
Tue Apr 20 10:26:43 CEST 2010
On 20 Apr, Marc Glisse wrote:
> On Mon, 19 Apr 2010, Marc Glisse wrote:
>
>> The easiest would probably be that I write a patch matching my understanding
>> so you can try it.
>
> Hello,
>
> could you check that with the attached patch the behavior is ok? Note that
> the patch only handles the mpz case, not mpq or mpf, and it may not be the
> best way to do it, but it should show if the idea is the right one.
Sorry, I forgot the test case
#include <iostream>
#include <sstream>
// #define USE_IO_EXCEPTIONS
int main() {
std::istringstream Inp("1123");
#ifdef USE_IO_EXCEPTIONS
Inp.exceptions(std::ios::failbit);
#endif
int I;
Inp >> std::hex >> I;
if ( Inp.fail() )
std::cout << "*** input failed ***\n";
else
std::cout << I << std::endl;
}
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
More information about the gmp-bugs
mailing list