CODING_STYLE: Add notes on avoiding trailing whitespace.

This commit is contained in:
Carl Worth 2006-06-06 16:28:15 -07:00
parent ef10a0403a
commit a21a2e935d

View file

@ -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: