summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2011-08-16 14:09:32 -0700
committerPaul Berry <stereotype441@gmail.com>2011-08-24 10:55:12 -0700
commit43968261e41aa7be915711451927a4e28c973690 (patch)
tree85229600fa383f0886f07b99023645bbdda09a04 /docs
parentddd6e5b8bce96cfcb72c7e7412296c9f39bdd5d7 (diff)
docs: Document coding style conventions
This patch documents some Mesa coding style conventions that came up during the discussion of commit 67b5a32 (Perform implicit type conversions on function call out parameters).
Diffstat (limited to 'docs')
-rw-r--r--docs/devinfo.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/devinfo.html b/docs/devinfo.html
index 8887dd0262..c0966480ab 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -72,6 +72,13 @@ If you use tabs, set them to 8 columns
</p>
<p>
+Line width: the preferred width to fill comments and code in Mesa is 78
+columns. Exceptions are sometimes made for clarity (e.g. tabular data is
+sometimes filled to a much larger width so that extraneous carriage returns
+don't obscure the table).
+</p>
+
+<p>
Brace example:
</p>
<pre>
@@ -81,10 +88,26 @@ Brace example:
else {
bar;
}
+
+ switch (condition) {
+ case 0:
+ foo();
+ break;
+
+ case 1: {
+ ...
+ break;
+ }
+
+ default:
+ ...
+ break;
+ }
</pre>
<p>
Here's the GNU indent command which will best approximate my preferred style:
+(Note that it won't format switch statements in the preferred way)
</p>
<pre>
indent -br -i3 -npcs --no-tabs infile.c -o outfile.c