From 43968261e41aa7be915711451927a4e28c973690 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 16 Aug 2011 14:09:32 -0700 Subject: [PATCH] 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). --- docs/devinfo.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/devinfo.html b/docs/devinfo.html index 8887dd02624..c0966480ab7 100644 --- a/docs/devinfo.html +++ b/docs/devinfo.html @@ -71,6 +71,13 @@ well documented. Also, strive to write clean, easily understandable code. If you use tabs, set them to 8 columns

+

+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). +

+

Brace example:

@@ -81,10 +88,26 @@ Brace example: else { bar; } + + switch (condition) { + case 0: + foo(); + break; + + case 1: { + ... + break; + } + + default: + ... + break; + }

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)

 	indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
-- 
2.30.2