summaryrefslogtreecommitdiff
path: root/CODING_STYLE
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-06-06 16:28:15 -0700
committerCarl Worth <cworth@cworth.org>2006-06-06 16:28:15 -0700
commita21a2e935d3a75b045ce5f7e917524052f018758 (patch)
tree695435068b65ce8ab26362b908477a43546afb5f /CODING_STYLE
parentef10a0403a8a466199615e34a34df9ea860ef9c0 (diff)
CODING_STYLE: Add notes on avoiding trailing whitespace.
Diffstat (limited to 'CODING_STYLE')
-rw-r--r--CODING_STYLE20
1 files changed, 17 insertions, 3 deletions
diff --git a/CODING_STYLE b/CODING_STYLE
index ab6e067a..4fb69247 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -132,7 +132,7 @@ structure definition:
struct _cairo_gstate {
cairo_operator_t op;
-
+
double tolerance;
/* stroke style */
@@ -146,19 +146,33 @@ structure definition:
double *dash;
int num_dashes;
double dash_offset;
-
+
...
}
Use a single space before a left parenthesis, except where the
standard will not allow it, (eg. when defining a parameterized macro).
-Don't eliminate whitespace just because things would still fit on one
+Don't eliminate newlines just because things would still fit on one
line. This breaks the expected visual structure of the code making it
much harder to read and understand:
if (condition) foo (); else bar (); /* Yuck! */
+Do eliminate trailing whitespace (space or tab characters) on any
+line. Also, avoid putting intial or final blank lines into any file,
+and never use multiple blank lines instead of a single blank line.
+
+Do enable the default git pre-commit hook that detect trailing
+whitespace for you and help you to avoid corrupting cairo's tree with
+it. Do that as follows:
+
+ chmod a+x .git/hooks/pre-commit
+
+You might also find the git-stripspace utility helpful which acts as a
+filter to remove trailing whitespace as well as initial, final, and
+duplicate blank lines.
+
As a special case of the bracing and whitespace guidelines, function
definitions should always take the following form: