• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1This document describes some aspects of the coding style of isl,
2which is similar to that of the linux kernel and git.
3
4The general rule is to use the same style as that of the surrounding code.
5
6More 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
33
34There are some exceptions to the general rule of using
35the same style as the surrounding code, most notably
36when the surrounding code is very old.
37In particular, an "isl_space" used to be called "isl_dim" and
38some variables of this type are still called "dim" or some variant thereof.
39New variables of this type should be called "space" or a more specific name.
40Some old functions do not have memory management annotations yet.
41All new functions should have memory management annotations,
42whenever appropriate
43