Overview

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

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

/*********************************************************************************************************************
 *
 * Some form of documentation here.
 *
 *********************************************************************************************************************/

 

The ForgeRock C coding style

Summary

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

Details

Consider the following example for the last few 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;
}