This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Funniness with operator>> (istream&, string&)
- To: scott snyder <snyder at d0sgibnl1 dot fnal dot gov>
- Subject: Re: Funniness with operator>> (istream&, string&)
- From: Benjamin Kosnik <bkoz at cygnus dot com>
- Date: Mon, 31 Jan 2000 14:42:27 -0800 (PST)
- cc: libstdc++ at sourceware dot cygnus dot com
> Yes, i saw that -- but that looks like a different potential infinite
> loop than the one i ran into. That DR appears to be talking about
> an infinite loop _inside_ operator>>, while mine is outside
> the operator and, as you note, has to do with failing to set failbit.
yup.
> Anyway, so it sounds like this is something which should get
> submitted as a defect report. I'll try to do that; it might be a few
> days before i get to it, though.
I've not seen traffic about this. I think it should be submitted--(can you
please do so?)
> 2000-01-23 scott snyder <snyder@fnal.gov>
>
> * bits/istream.tcc (operator>>(istream&, string&)): Set failbit if
> we don't extract any characters.
>
>
>
> Index: bits/istream.tcc
> ===================================================================
> RCS file: /cvs/libstdc++/libstdc++/bits/istream.tcc,v
> retrieving revision 1.36
> diff -u -p -r1.36 istream.tcc
> --- istream.tcc 2000/01/12 10:12:38 1.36
> +++ istream.tcc 2000/01/26 06:51:38
> @@ -1125,8 +1125,13 @@ namespace std {
> else
> __in.setstate(ios_base::eofbit);
>
> + if (!__extracted)
> + __in.setstate (ios_base::failbit);
> +
> __in.width(0);
> }
> + else
> + __in.setstate (ios_base::failbit);
> return __in;
> }
>
>
a couple things:
1) need to wrap with _GLIBCPP_RESOLVE... macro. Need defect number for
this. . .
2) one test, like other istream member functions. . .
like so:
*** 1127,1132 ****
--- 1127,1137 ----
__in.width(0);
}
+ #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // 2000-02-01 Number to be determined
+ if (!__extracted)
+ __in.setstate (ios_base::failbit);
+ #endif
return __in;
}
okay?
can I add your orig test case to the correct testsuites/27_io/* file?
thanks,
benjamin