Problem with iostream clear(), gcc version 3.0 20010223

Phil Edwards pedwards@disaster.jaj.com
Sun Feb 25 18:32:00 GMT 2001


On Sat, Feb 24, 2001 at 08:59:39PM -0500, Craig Rodrigues wrote:
> On Sat, Feb 24, 2001 at 08:20:11PM -0500, Phil Edwards wrote:
> > On Sat, Feb 24, 2001 at 06:21:09PM -0500, Craig Rodrigues wrote:
> > >  
> > >       std::cin.clear(5);
> > 
> > clear() takes a variable of type iostate.
> > 
> > 5 is not of type iostate.
> > 
> > What's the problem?
[...]
> The actual code has an object (named server) which inherits from iostream.
> On the server object, clear() is invoked with:
> server.clear(0);

Ah.  Looks like code from the Bad Old Days of C++, when there was an
implicit conversion from integers to enums.  Can't do that anymore.
(You can allow it with an -f switch, I think.)

You must pass an iostate variable to clear(), but fortunately it has a
default, and it looks like that code is trying to accomplish the same thing
as the default; namely, clear all the error flags and go to a good state.
If that's the intent, you can replace it with "server.clear();" and all
is well.


> I am also getting a lot of template instantiation problems associated
> with iostreams that I was not getting last week.

Don't know about those off hand, and can't currently investigate 'cause
Kenner's gone and broken the x86 target again.  :-)  Give it a few days.


Phil

-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.



More information about the Libstdc++ mailing list