This document covers coding guidelines to use when writing C code.  It is very much a WORK IN PROGRESS.

Copyright notices

All new source files must begin with the same copyright notice as recommended in the Coding Style and Guidelines


The ForgeRock C coding style


The ForgeRock C code style rules are based on the Java conventions with some deviations, the key points being:


Consider the following example for a few of the points listed above:

unsigned int *index = ..., entry_index = 0;
if (index) *index = entry_index;

should be written as:

unsigned int*  index = ...;
unsigned int   entry_index = 0;

if (index != NULL) {
    *index = entry_index;

When writing particularly dense code, it is desirable to separate functions with some manner of visual separator.  The following is recommended:

 * Document the purpose of the function.
 * Document the returned value for any non void function.