Debian Codegraph @

HACKING

raw
1 Coding Style
2 ============
3
4 * Follow the coding style already used.
5 * Trailing whitespace is not allowed.
6 * Use spaces (not tabs) for indentation.
7 * Brace on same line as block statement.
8 * Use braces on all blocks (even single line blocks).
9 * Code must conform to C89/C90 (ANSI/ISO C) (ie. no C99).
10 * Spaces between functions and arguments, or macros and arguments.
11 * Spaces before and after most binary operators.
12 * Spaces after most unary operators (including a comma).
13 * Return value on line before function definition.
14 * Brace on line after function definition.
15 * Do not initialize local variables in their declarations.
16 * Line up function arguments in declarations.
17 * One variable declaration per line.
18 * Line up variable names in declarations.
19 * Limit the use of function prototypes by defining functions
20 in the file before they are used.
21 * Whenever possible conditional expressions should not have side
22 effects (eg. don't set a value or call a function in an if
23 statement).
24 * '*' goes with variable not type, when declaring a pointer.
25 * Function arguments follow the function call on the same line, and if
26 lengthy are (where possible) wrapped to the column of the first brace.
27 * Always compare pointers with NULL instead of using "!".
28 * If you make a non-trivial and copyrightable change to a file
29 be sure to add your name to the copyright information at the
30 beginning of the file.
31 * Use gtk-doc style comments on public functions whenever possible.
32 * In most cases, don't abbreviate words in function and variable names.
33 * Function names are lowercase, words separated by underscores.
34 * Macros and enums are all uppercase, words seperated by
35 underscores.
36 * Types are all words capitalized, no separators between words.
37
38 * Don't use gchar. "char" is just fine.
39 * Public functions should check input using g_return_if_fail.
40 * Private functions should check input using g_assert.
41 * Handle the default case in switch statements with
42 a warning or g_assert_not_reached.
43 * Prefer glib functions over native ones when available.
44 * Use glib string handling functions when possible.
45
46 * When in doubt copy the style of the rest of the file.