LOGO ExectOS Operating System

ExectOS Coding Style

This document outlines our coding style guidelines. If you have suggestions for things that should be clarified better, contact with us. With a continuous stream of contributions and patches we would like the our code base to remain clean and easy to read and maintain.

General

Each source file should contain a header:

/**
 * PROJECT:         ExectOS
 * COPYRIGHT:       See COPYING.md in the top level directory
 * FILE:            path/to/source/file.c
 * DESCRIPTION:     Description of the purpose of the code in this file
 * DEVELOPERS:      Your Name <name@codingworkshop.eu.org>
 */

You should only add yourself to the developer list if you are making a significant contribution, which means you understand the purpose of the code in this file and you can provide support to anyone.

Indentation and whitespace

switch(Condition)
{
    case 1:
        CallFunction();
        break;
    default:
        CallAnotherFunction();
        break;
}

CallOtherFunction(Argument1, Argument2, Argument3,
                  Argument4, Argument5);

Pointer = (PVOID)Address;

Miscellaneous formatting

Identifiers

typedef char BOOL;

typedef struct _NEW_STRUCTURE
{
    BOOL Enabled;
    PVOID Pointer;
} NEW_STRUCTURE, *PNEW_STRUCTURE;

XTAPI
VOID
KeStartKernel();

Variable declarations

Comments

/* This is a C-style comment */

/* This is a valid
 * multi-line comment */

Documentation

/**
 * Multi-line routine description.
 *
 * @param Parameter1
 *        Description of the first parameter goes here.
 *
 * @param Parameter2
 *        Description of the seconds parameter goes here.
 *
 * @return Short description about return values.
 *
 * @since Information from which version a given function is available.
 *
 * @see Optional link to documentation or reference implementation.
 *
 * @todo Optional description, telling what is missing in the function implementation.
 */

Miscellaneous