isl_local_space_divs_known: extract out isl_local_divs_known
[isl.git] / doc / CodingStyle
blob21f2e56a5712845005534dc1ddf5ace0780e70b6
1 This document describes some aspects of the coding style of isl,
2 which is similar to that of the linux kernel and git.
4 The general rule is to use the same style as that of the surrounding code.
6 More specific rules:
7         - every line should have at most 80 columns
8         - use tabs for indentation, where a tab counts for 8 characters
9         - use single spaces around binary operators such as '+', '-', '=', '!='
10         - no space after unary operators such as '!'
11         - use a single space after a comma and a semicolon
12           (except at the end of a line)
13         - no space between function name and arguments
14         - use a single space after control keywords such as if, for and while
15         - use a single space between the type of a cast and the value
16           that is being cast
17         - no whitespace at the end of a line
18         - opening brace of a function is placed on a new line
19         - opening brace of other blocks stays on the same line
20         - the body of a control statement is placed on the next line(s)
21         - an else appears on the same line as the closing brace of
22           the then branch, if there is such a closing brace
23         - if either the then or the else branch of an if has braces,
24           then they both have braces
25         - no parentheses around argument of return keyword
26         - use only C style comments (/* ... */)
27         - no comments inside function bodies;
28           if some part of a function deserves additional comments, then
29           extract it out into a separate function first
30         - no #ifs inside function bodies
31         - variables are declared at the start of a block, before any
32           other statements
34 There are some exceptions to the general rule of using
35 the same style as the surrounding code, most notably
36 when the surrounding code is very old.
37 In particular, an "isl_space" used to be called "isl_dim" and
38 some variables of this type are still called "dim" or some variant thereof.
39 New variables of this type should be called "space" or a more specific name.
40 Some old functions do not have memory management annotations yet.
41 All new functions should have memory management annotations,
42 whenever appropriate