Update of "Coding Guidelines"
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: fc33861db22a0698644f4f83709d7e3dca640223
Page Name:Coding Guidelines
Date: 2018-11-07 18:44:33
Original User: maxi
Parent: 32b6d3cd76e31de056f2d930b3c5ee0c66710c02
Content

Coding guidelines for CLINL

These guidelines shall be applied in every file that is pushed to the CLINL-Repository. Noncompliant modifications will be rejected.

Basic Principle

The sheer act of coding cleanly is a hard strain which is often neglected in order to better fulfill other duties. In order to counteract several strategies can be applied. One such for example is the act of refactoring one's code after having a working codebase.

The boy scout's rule

The boy scout's rule states that you shall leave a ground cleaner than what you found it. Analog to that, every programmer who pushes changes to the CLINL-Repository shall refactor, no matter how small the effect, every file he enters. This way, we can guarantee long-lasting high code quality standards.

The Makefile

The makefile is individual. Every contributor shall keep a local copy of his makefile in order to be able to reuse it even after pulling code from others. Code quality doesn't matter in the makefile

Code

Functions

Functions shall not be longer than 15 lines. A good function is smaller than 7 Lines. If possible, a function should be inlined. The number of function argument should be reduced, 4 is the upper maximum, anything above should be compacted into a struct. exceptions to be made.

Inline Assembly

Inline assembly shall not be used in files other than those inside of the folder ```include/asm_shims```.

Classes

All classes should serve only one single purpose. Splitting too big of a class into two separate classes is often very sensible. Initialisation should always be performed in the most efficient way, which would mean that ``` class a { int b; a (int c) { b = c; } }; ``` becomes ``` class a{ int b; a (int c) : b(c) { } }; ```

namespaces

There are two types of namespaces used in CLINL. Internal namespaces and external namespaces. Internals are used to group the tools used by external namespaces.

Standard Library

If a function is available in the standard library provided in the folder ```include/