Diff for "CodingStyle"

Differences between revisions 10 and 11
Revision 10 as of 2012-03-22 00:18:40
Size: 1557
Comment: link to indent script used
Revision 11 as of 2012-03-28 10:19:58
Size: 1616
Editor: host-89-242-29-156
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
We use the `indent` command line in this script here: http://cgit.freedesktop.org/xorg/util/modular/tree/x-indent.sh?id=ea4c1a71bc5fc05026badb7d7ce1e560a5b3d1b5 We use the `indent` command line in this script here: http://cgit.freedesktop.org/xorg/util/modular/tree/x-indent.sh with manual editing afterwards to fix the cases where indent gets hopelessly confused.
Line 5: Line 5:
 * Four-space indents  * Four-space indents (no tabs, not even if your editor wants to collapse eight consecutive spaces down to a single tab)
Line 8: Line 8:
 * Keywords punctuated like `if (x >= 0)`
 * Functions punctuated like `doSomethingClever(a, b, c);`
Line 14: Line 12:
 * Keywords punctuated like `if (x >= 0)`
 * Functions punctuated like `doSomethingClever(a, b, c);`
Line 15: Line 15:
 * If wrapping is required, function arguments to be aligned to the opening parenthesis of that column
Line 16: Line 17:
 * ANSI prototypes for all new code; convert K&R declarations to ANSI with care
   * If wrapping is required, function arguments to be aligned to the opening parenthesis of that column

This page describes the X server's current coding style. While the server was recently reformatted to fit this style, most modules have varied and disparate coding styles. Above all, the cardinal rule is to fit in: make sure your changes reflect the coding style of the surrounding code.

We use the indent command line in this script here: http://cgit.freedesktop.org/xorg/util/modular/tree/x-indent.sh with manual editing afterwards to fix the cases where indent gets hopelessly confused.

Notable objectionable things in the current coding style: