Coding Guidelines

From the makers of InspIRCd.
Revision as of 15:40, 3 July 2006 by Om (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

InspIRCd Coding Guidelines

The following are a set of guidelines for writing patches to InspIRCd, or for creating modules for distribution with the official package. These guidelines were written a time after InspIRCd development started, and so not all code yet follows these. This will be rectified with time.

Comments

Multi Line

Multiple line comments should follow the C-style comment, for example:

/*
 * This is a multiple line comment, huzzah..
 */

Single Line

Single line comments should also be in the C style, for example:

/* This is a boring one-line comment */

Indentation

Tabs. Tabs. ONLY TABS. Use a single tab for each level of indentation, for example:

int main()
{
<tab>if (condition)
<tab>{
<tab><tab>code
<tab>}
}

Separation

Always put a space in between a keyword like if/while and the condition, for example:

if (foo == bar)

NOT

if(foo == bar)

Braces

Always put braces opening and closing blocks on separate lines, see the identation example.