Coding style

Wiki page by khorben on 28/10/2010 03:10:42

General rules

Indenting and spaces

Throughout all of the project, a tab spacing of 8 spaces has been used. This is the default on most platforms, and the only one tolerated for the project.

Likewise, a maximum width of 80 characters per line is enforced, for the following reasons:
  • it is easier to read shorter lines,
  • more generally, to maintain readability on each and every text console,
  • to be also as readable as likely on even smaller screens (eg embedded devices)
  • to enforce source code to be written with a maximum of three sub-scopes per function.
Generally speaking, the natural indenting algorithm of the vim text editor is considered the correct one.

Spurious spaces at the end of lines, or lines containing solely white-space characters are forbidden.

Specific to the C programming language

Any function and variable that is not meant to be exported (available to other objects) must be declared "static", and prefixed with an underscore ("_").

Specific to the Gtk+ library

Any function that is not available in Gtk+ 2.4 should not be relied upon; the program must compile and work normally without them. It is encouraged to use newer, better functions when available; they must however be accompanied by a fallback version of the code.

Dialog windows should use the GtkDialog class by default.
1.7 (diff)khorben
1.6 (diff)khorben
1.5 (diff)khorben
1.4 (diff)khorben
1.3 (diff)khorben
1.2 (diff)khorben