1553af2a3STobias GrosserThis document describes some aspects of the coding style of isl,
2553af2a3STobias Grosserwhich is similar to that of the linux kernel and git.
3553af2a3STobias Grosser
4553af2a3STobias GrosserThe general rule is to use the same style as that of the surrounding code.
5553af2a3STobias Grosser
6553af2a3STobias GrosserMore specific rules:
7553af2a3STobias Grosser	- every line should have at most 80 columns
8553af2a3STobias Grosser	- use tabs for indentation, where a tab counts for 8 characters
9553af2a3STobias Grosser	- use single spaces around binary operators such as '+', '-', '=', '!='
10553af2a3STobias Grosser	- no space after unary operators such as '!'
11553af2a3STobias Grosser	- use a single space after a comma and a semicolon
12553af2a3STobias Grosser	  (except at the end of a line)
13553af2a3STobias Grosser	- no space between function name and arguments
14553af2a3STobias Grosser	- use a single space after control keywords such as if, for and while
15*c59f22c5SMichael Kruse	- use a single space between the type of a cast and the value
16*c59f22c5SMichael Kruse	  that is being cast
17553af2a3STobias Grosser	- no whitespace at the end of a line
18553af2a3STobias Grosser	- opening brace of a function is placed on a new line
19553af2a3STobias Grosser	- opening brace of other blocks stays on the same line
20553af2a3STobias Grosser	- the body of a control statement is placed on the next line(s)
21*c59f22c5SMichael Kruse	- an else appears on the same line as the closing brace of
22*c59f22c5SMichael Kruse	  the then branch, if there is such a closing brace
23*c59f22c5SMichael Kruse	- if either the then or the else branch of an if has braces,
24*c59f22c5SMichael Kruse	  then they both have braces
25553af2a3STobias Grosser	- no parentheses around argument of return keyword
26553af2a3STobias Grosser	- use only C style comments (/* ... */)
27553af2a3STobias Grosser	- no comments inside function bodies;
28553af2a3STobias Grosser	  if some part of a function deserves additional comments, then
29553af2a3STobias Grosser	  extract it out into a separate function first
30*c59f22c5SMichael Kruse	- no #ifs inside function bodies
31*c59f22c5SMichael Kruse	- variables are declared at the start of a block, before any
32*c59f22c5SMichael Kruse	  other statements
33553af2a3STobias Grosser
34553af2a3STobias GrosserThere are some exceptions to the general rule of using
35553af2a3STobias Grosserthe same style as the surrounding code, most notably
36553af2a3STobias Grosserwhen the surrounding code is very old.
37553af2a3STobias GrosserIn particular, an "isl_space" used to be called "isl_dim" and
38553af2a3STobias Grossersome variables of this type are still called "dim" or some variant thereof.
39553af2a3STobias GrosserNew variables of this type should be called "space" or a more specific name.
40553af2a3STobias GrosserSome old functions do not have memory management annotations yet.
41553af2a3STobias GrosserAll new functions should have memory management annotations,
42553af2a3STobias Grosserwhenever appropriate
43