====== Coding Style ====== The most important rules are as follows: * If you modify someone elses files, try to stick to the coding style used in that file, even if your personal taste or preferrences are different. What we aim at is consistent coding style across files and modules, not across the whole source tree. * If you intend to create a new module, you are free to choose your own coding style, but we would highly recommend you to follow the rules below. The rules below should make it easier for other developers to read and understand your code quickly. It is especially important if want others to help you with your code. ===== Important Rules ===== * Make sure that your editor uses tabs for indentation. * Set tab stops to 4 spaces. This will make the code look nicer in your editor. * Wrap lines that are longer than 78 characters (80 characters - two characters for window decorations). * Try to stay away from C++ style comments (%%//%%), not all compilers allow them when compiling C code. * Unless absolutely necessary, do not declare variables inside blocks. It is better to have all variables declared at one place (i.e. at the beginning of the function or file). The following examples illustrate what you SHOULD NOT do: if () { int i; ... } or for (i=0; ...) { int a; ... } * Use the following style for function declarations int func(int x) { /* body */ } * If you have source file ''foo.c'' and associated header file ''foo.h'' with interface to the source file, make sure that ''foo.c'' includes ''foo.h'' as the very first header file. This way the compiler will report an error if there is a header file missing in ''foo.h''.