This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Fix libstdc++/9563
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Jerry Quinn <jlquinn at optonline dot net>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 13 Feb 2003 10:16:55 +0100
- Subject: Re: [Patch] Fix libstdc++/9563
- References: <E18jADJ-0004cn-00@tiamat>
Jerry Quinn wrote:
Seems like this should reduce the impact of the extra required checking.
I agree. However, I have double checked a few other widespread
implementations: no-one seems to implement the optimization and
its additional complexity. Is it really worty?
But... I have got an idea... Do you believe would be ok rewriting
the code simply like this:
: _M_os(__os)
{
// XXX MT
if (__os.tie() && __os.good())
^^^^^^^^^^^^^^^^^^^^^^^^^
__os.tie()->flush();
if (__os.good())
_M_ok = true;
else
{
_M_ok = false;
__os.setstate(ios_base::failbit);
}
}
First blush, there is nothing wrong with checking that __os.tie() is not
a null pointer even if we are still not sure that __os.good() is true!
And in this way if __os.tie() is a null pointer we call __os.good() just
one time as in your solution.
What do you think?
Paolo.