aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-22 16:54:14 +0000
committerChris Lattner <sabre@nondot.org>2009-07-22 16:54:14 +0000
commit59fec6a53234df91d6b66d5826ef1f8ce60af2fa (patch)
tree7e9d69edfdeb6fd3f5a3e34237da615bddb2045b /docs
parent38c336309052f32aae22ae9fe265c7f84389ba11 (diff)
downloadexternal_llvm-59fec6a53234df91d6b66d5826ef1f8ce60af2fa.zip
external_llvm-59fec6a53234df91d6b66d5826ef1f8ce60af2fa.tar.gz
external_llvm-59fec6a53234df91d6b66d5826ef1f8ce60af2fa.tar.bz2
fix some wording problems Daniel pointed out, make a example actually real.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/CodingStandards.html47
1 files changed, 27 insertions, 20 deletions
diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html
index 8d46000..2068c0f 100644
--- a/docs/CodingStandards.html
+++ b/docs/CodingStandards.html
@@ -631,7 +631,7 @@ be a big understandability win.</p>
<div class="doc_text">
-<p>It is very common to write inline functions that just compute a boolean
+<p>It is very common to write small loops that just compute a boolean
value. There are a number of ways that people commonly write these, but an
example of this sort of thing is:</p>
@@ -653,8 +653,8 @@ be a big understandability win.</p>
<p>This sort of code is awkward to write, and is almost always a bad sign.
Instead of this sort of loop, we strongly prefer to use a predicate function
(which may be <a href="#micro_anonns">static</a>) that uses
-<a href="#hl_earlyexit">early exits</a> to compute the predicate. Code like
-this would be preferred:
+<a href="#hl_earlyexit">early exits</a> to compute the predicate. We prefer
+the code to be structured like this:
</p>
@@ -1050,21 +1050,27 @@ example:
<div class="doc_code">
<pre>
-/// SomeCrazyThing - This namespace contains flags for ...
-namespace SomeCrazyThing {
- enum foo {
- /// X - This is the X flag, which is ...
- X = 1,
-
- /// Y - This is the Y flag, which is ...
- Y = 2,
-
- /// Z - This is the Z flag, which is ...
- Z = 4,
-
- /// ALL_FLAGS - This is the union of all flags.
- ALL_FLAGS = 7
- };
+namespace llvm {
+ namespace X86 {
+ /// RelocationType - An enum for the x86 relocation codes. Note that
+ /// the terminology here doesn't follow x86 convention - word means
+ /// 32-bit and dword means 64-bit.
+ enum RelocationType {
+ /// reloc_pcrel_word - PC relative relocation, add the relocated value to
+ /// the value already in memory, after we adjust it for where the PC is.
+ reloc_pcrel_word = 0,
+
+ /// reloc_picrel_word - PIC base relative relocation, add the relocated
+ /// value to the value already in memory, after we adjust it for where the
+ /// PIC base is.
+ reloc_picrel_word = 1,
+
+ /// reloc_absolute_word, reloc_absolute_dword - Absolute relocation, just
+ /// add the relocated value to the value already in memory.
+ reloc_absolute_word = 2,
+ reloc_absolute_dword = 3
+ };
+ }
}
</pre>
</div>
@@ -1114,7 +1120,8 @@ the contents of the namespace.</p>
<div class="doc_text">
-<p>A common topic after talking about namespaces is anonymous namespaces.
+<p>After talking about namespaces in general, you may be wondering about
+anonymous namespaces in particular.
Anonymous namespaces are a great language feature that tells the C++ compiler
that the contents of the namespace are only visible within the current
translation unit, allowing more aggressive optimization and eliminating the
@@ -1186,7 +1193,7 @@ bool StringSort::operator&lt;(const char *RHS) const {
of a large C++ file, that you have no immediate way to tell if it is local to
the file. When it is marked static explicitly, this is immediately obvious.
Also, there is no reason to enclose the definition of "operator&lt;" in the
-namespace since it was declared there.
+namespace just because it was declared there.
</p>
</div>