aboutsummaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-04-01 17:51:01 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:23 +0100
commit7906eea45cdfbe54be96d6bc99906e492d14f284 (patch)
tree5e480863f49bd83e41f0831f1fe7e603ef967fba /doc/reference
parentee02a33acba401edb89d0abf5b4f52be79fe603b (diff)
Update coding style
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/xml/coding-standards.xml34
1 files changed, 33 insertions, 1 deletions
diff --git a/doc/reference/xml/coding-standards.xml b/doc/reference/xml/coding-standards.xml
index e3d549f4..242719de 100644
--- a/doc/reference/xml/coding-standards.xml
+++ b/doc/reference/xml/coding-standards.xml
@@ -39,7 +39,22 @@ Whenever you edit a source file, don't forget to update the copyright dates at t
<para>
<emphasis>Indentation</emphasis> is done with <emphasis>tabs</emphasis> and
<emphasis>alignment</emphasis> is done with spaces. This way, the code looks
-neat whatever width you configure your editor to display tabs as.
+neat whatever width you configure your editor to display tabs as. This means,
+for example:
+</para>
+<para>
+<programlisting>
+struct something
+{
+ int thing; /* &lt;--- spaces used to align comments */
+ int thing_with_longer_name; /* &lt;--- spaces used to align comments */
+}
+
+void somefunction(int something)
+{
+ /* &lt;--- Tab character used at the start of this line */
+}
+</programlisting>
</para>
<para>
However, code must be <emphasis>strictly</emphasis> wrapped at 80 columns, or
@@ -47,6 +62,23 @@ what would be 80 columns if the tabs were displayed as 8 spaces.
If you think you need more width, you're at too many levels of indentation and
need to break things down a bit.
</para>
+<para>
+When performing a two or three dimensional iteration, for example over image
+coordinates or Miller indices, it is acceptable to indent as follows:
+</para>
+<para>
+<programlisting>
+for ( h=-10; h&lt;+10; h++ ) {
+for ( k=-10; k&lt;+10; k++ ) {
+for ( l=-10; l&lt;+10; l++ ) {
+
+ /* Do stuff */
+
+}
+}
+}
+</programlisting>
+</para>
</refsect1>