Add a note about endl semantics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1502 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html
index 62288cc..8566e67 100644
--- a/docs/CodingStandards.html
+++ b/docs/CodingStandards.html
@@ -37,6 +37,7 @@
<ol>
<li><a href="#hl_assert">Assert Liberally</a>
<li><a href="#hl_preincrement">Prefer Preincrement</a>
+ <li><a href="#hl_avoidendl">Avoid endl</a>
<li><a href="#hl_exploitcpp">Exploit C++ to its Fullest</a>
</ol>
<li><a href="#iterators">Writing Iterators</a>
@@ -293,6 +294,19 @@
<!-- _______________________________________________________________________ -->
+</ul><a name="hl_avoidendl"><h4><hr size=0>Avoid endl</h4><ul>
+
+The <tt>endl</tt> modifier, when used with iostreams outputs a newline to the output stream specified. In addition to doing this, however, it also flushes the output stream. In other words, these are equivalent:<p>
+
+<pre>
+ cout << endl;
+ cout << "\n" << flush;
+</pre>
+
+Most of the time, you probably have no reason to flush the output stream, so it's better to use a literal <tt>"\n"</tt>.<p>
+
+
+<!-- _______________________________________________________________________ -->
</ul><a name="hl_exploitcpp"><h4><hr size=0>Exploit C++ to its Fullest</h4><ul>
C++ is a powerful language. With a firm grasp on its capabilities, you can make write effective, consise, readable and maintainable code all at the same time. By staying consistent, you reduce the amount of special cases that need to be remembered. Reducing the total number of lines of code you write is a good way to avoid documentation, and avoid giving bugs a place to hide.<p>
@@ -646,7 +660,7 @@
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
<!-- hhmts start -->
-Last modified: Mon Oct 1 15:33:40 CDT 2001
+Last modified: Sun Jan 20 13:01:02 CST 2002
<!-- hhmts end -->
</font>
</body></html>