title: Should std::endl always be used?
body: <p>I am jumping from C into C++ with the help of the book <em>C++ Primer</em> (5th edition) where the author states the following:</p>
  
  <blockquote>
    <p>Programmers often add print statements during debugging. Such
    statements should always flush the stream. Otherwise, if the program
    crashes, output may be left in the buffer, leading to incorrect
    inferences about where the program crashed.</p>
  </blockquote>
  
  <p>But posts online suggest otherwise; some say constant flushing of the buffer is bad for the program and causes performance issues.</p>
  
  <p>My questions:</p>
  
  <ol>
  <li>When should you use <code>std::endl</code>?   </li>
  <li>Is the author wrong or did I misunderstand any part of what he stated?  </li>
  <li>Can you give any real-world scenarios where flushing the output stream is necessary?</li>
  </ol>
  
  <p>P.S.</p>
  
  <ol start="4">
  <li>What does flushing the buffer mean?</li>
  </ol>