Codebase list cdebconf / f7b6c421-4291-4f51-b223-5b16565fee2c/main doc / coding.txt
f7b6c421-4291-4f51-b223-5b16565fee2c/main

Tree @f7b6c421-4291-4f51-b223-5b16565fee2c/main (Download .tar.gz)

coding.txt @f7b6c421-4291-4f51-b223-5b16565fee2c/mainraw · history · blame

Coding style/standards
----------------------

This is another one of those "object-oriented" C programs. Each "class" is
associated with one program file, which defines a data-structure and a set of 
methods that operate on that structure. All the methods take the class data 
structure as the first parameter. The exception to this is the _new method, 
which is the constructor for the class. It takes whatever initialization 
parameters are needed, and returns a pointer to a class structure. The 
destructor, if one exists, is canonically named class_delete.

Macros are used for various convenience things, and follow the naming convention
of their C++ or perl counterparts.

In general the code follows the following conventions:

- variables and functions are lower-case. multi-word identifiers are joined
  by underbars (like_this). 
- tabs are 4 spaces. Avoid using ^I
- braces are always on a line by itself, and line up with the controlling
  block construct.
- in general, keep things consistent with the surrounding code