Coding conventions

This page list the coding conventions that applies to GCstar’s code source. You should conform to them when modifying some code or creating new plugins. You may be used to other conventions. None of them are perfect. But using always the same ones in a project make work easier for all of the developers when maintenance or evolution are required.

Indentation

| Top |

Always indent your code using spaces (ASCII code 32) and not tabulations. Use 4 spaces for each level of indentation.

Brackets

| Top |

For all functions, loops or any block, the opening curly bracket should be placed alone on one line, at the same indent level as the previous line. The closing bracket should be aligned with the first one. Here is an example:

sub myMethod
{
    # Some code here
    while ($condition)
    {
        # Loop code
    }
    if ($anotherCondition)
    {
        # if code
    }
    else
    {
        # else code
    }
}

You may notice also that the else keyword should be placed on its own line.

Specific Perl features

| Top |

All the code should be done using strict code. So all of the Perl files, including the plugins, should contain this line on top of them:

use strict;
 
en/coding_conventions.txt · Last modified: 12/06/2007 19:21 by Tian



Should you have a problem using GCstar, you can open a bug report or request some support on GCstar forums.