Blame isl-0.16.1/doc/CodingStyle

Packit fb9d21
This document describes some aspects of the coding style of isl,
Packit fb9d21
which is similar to that of the linux kernel and git.
Packit fb9d21
Packit fb9d21
The general rule is to use the same style as that of the surrounding code.
Packit fb9d21
Packit fb9d21
More specific rules:
Packit fb9d21
	- every line should have at most 80 columns
Packit fb9d21
	- use tabs for indentation, where a tab counts for 8 characters
Packit fb9d21
	- use single spaces around binary operators such as '+', '-', '=', '!='
Packit fb9d21
	- no space after unary operators such as '!'
Packit fb9d21
	- use a single space after a comma and a semicolon
Packit fb9d21
	  (except at the end of a line)
Packit fb9d21
	- no space between function name and arguments
Packit fb9d21
	- use a single space after control keywords such as if, for and while
Packit fb9d21
	- use a single space between the type of a cast and the value
Packit fb9d21
	  that is being cast
Packit fb9d21
	- no whitespace at the end of a line
Packit fb9d21
	- opening brace of a function is placed on a new line
Packit fb9d21
	- opening brace of other blocks stays on the same line
Packit fb9d21
	- the body of a control statement is placed on the next line(s)
Packit fb9d21
	- an else appears on the same line as the closing brace of
Packit fb9d21
	  the then branch, if there is such a closing brace
Packit fb9d21
	- if either the then or the else branch of an if has braces,
Packit fb9d21
	  then they both have braces
Packit fb9d21
	- no parentheses around argument of return keyword
Packit fb9d21
	- use only C style comments (/* ... */)
Packit fb9d21
	- no comments inside function bodies;
Packit fb9d21
	  if some part of a function deserves additional comments, then
Packit fb9d21
	  extract it out into a separate function first
Packit fb9d21
	- no #ifs inside function bodies
Packit fb9d21
	- variables are declared at the start of a block, before any
Packit fb9d21
	  other statements
Packit fb9d21
Packit fb9d21
There are some exceptions to the general rule of using
Packit fb9d21
the same style as the surrounding code, most notably
Packit fb9d21
when the surrounding code is very old.
Packit fb9d21
In particular, an "isl_space" used to be called "isl_dim" and
Packit fb9d21
some variables of this type are still called "dim" or some variant thereof.
Packit fb9d21
New variables of this type should be called "space" or a more specific name.
Packit fb9d21
Some old functions do not have memory management annotations yet.
Packit fb9d21
All new functions should have memory management annotations,
Packit fb9d21
whenever appropriate