Initialize the addr struct to zero.
[beanstalkd.git] / STYLE
blob1bdce328709b93a1cfee1a24ddaed2f3f37a46ac
1 Here is a description of the prevailing coding style in beanstalkd. Overall,
2 our style is pretty close to K&R style, but there are a few differences.
4 Really the only important rule is to follow the style of existing code. This
5 document is just to help you out by describing some aspects of that style
6 explicitly.
8 If in doubt, ask the list at beanstalk-talk@googlegroups.com.
10  * Use no tabs, only spaces.
12  * Limit lines to 80 columns.
14  * Indent by four spaces.
16  * Do not include trailing spaces.
18  * Surround binary operators (indluding boolean, arithmetic, and assignment)
19    with a space on each side.
21  * Put the name of a function definition on the line after the function's
22    return type.
24  * Put the opening curly brace of a function on a line by itself in the first
25    column.
27  * Put a blank line after a block of declarations.
29  * Put a blank line after each function.
31  * Put the opening curly brace of an "if" or "for" statement on the same line
32    as the "if" or "for" keyword.
34  * If the body of an "if" or "for" statement fits on the same line, you can
35    leave off the braces. For example, write
37      if (x) return;
39    instead of
41      if (x) {
42          return;
43      }
45    However, always include the braces when there is an "else" clause.
47  * Put the "else" keyword on the same line as the preceding closing curly
48    brace.
50  * When testing pointers, don't compare them to NULL; instead test the value
51    directly. For example, write
53      if (x && !y)
55    instead of
57      if (x != NULL && y == NULL)