This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

forwarded message from Jerry Quinn


Reposting - I seem to have been caught by a spam filter this morning.

--- Begin Message ---
Paolo Carlini writes:
 > 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?

Well, we're still a factor of 2 slower than gcc 2.95 for basic number
and small string writing.  So every little bit helps.

 > 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.

This looks great.  I wish I'd thought of it :-)

Jerry
--- End Message ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]