ATF-log archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: #6: Audit use of std::endl



#6: Audit use of std::endl
----------------------+-----------------------------------------------------
  Reporter:  jmmv     |       Owner:  jmmv
      Type:  defect   |      Status:  new 
  Priority:  minor    |   Milestone:      
 Component:  atf-c++  |     Version:      
Resolution:           |    Keywords:      
----------------------+-----------------------------------------------------

Comment (by gcooper@...):

 (I'm a C++ novice, but here's what I understand)

 std::endl also flushes the std::stream in addition to punting out a
 newline.

 The end result of calling:

 {{{
 cout << "foo" << std::endl;
 }}}

 is similar to:

 {{{
 fprintf(stdout, "foo\n");
 fflush(stdout);
 }}}


 You're taking a performance hit every time you use fflush because you have
 to flush the output using the underlying hooks in the OS to flush out the
 buffer which goes with stdout.

 More ranting about this can be found here:
 http://www.velocityreviews.com/forums/t280899-std-endl.html (there are
 some useful comments amongst some of the fud).

-- 
Ticket URL: <http://www.julipedia.org/projects/atf/trac/ticket/6#comment:1>
Automated Testing Framework <http://www.NetBSD.org/~jmmv/atf/>
Automated Testing Framework


Home | Main Index | Thread Index | Old Index