<p>Many C++ books contain example code like this...</p>

<pre><code>std::cout &lt;&lt; "Test line" &lt;&lt; std::endl;
</code></pre>

<p>...so I've always done that too. But I've seen a lot of code from working developers like this instead:</p>

<pre><code>std::cout &lt;&lt; "Test line\n";
</code></pre>

<p>Is there a technical reason to prefer one over the other, or is it just a matter of coding style?</p>

There might be performance issues,
```
std::endl
```
forces a flush of the output stream.