Difference between revisions of "Coding style"
m (→Indentation: Corrected spelling; clarified text) |
|||
Line 8: | Line 8: | ||
Don't use tabulators. People have different ideas how many chars a tabulator might be so sources using tabulators might look strange. | Don't use tabulators. People have different ideas how many chars a tabulator might be so sources using tabulators might look strange. | ||
− | == | + | == Indentation == |
− | + | Indentation size is always 2 space characters per level. | |
== Newlines == | == Newlines == |
Revision as of 10:56, 21 January 2008
Introduction
Some people might think that the coding style used by the FPC compiler sources and base rtl is a little bit strange but it has been used for a lot of years and isn't subject to be discussed. So take the following as a standard to be used.
Keywords
All keywords are written in lower case. There is no need to make them unreadble by writing them upper case. Modern IDEs support highlighting so keywords will be recognized.
Tabulators
Don't use tabulators. People have different ideas how many chars a tabulator might be so sources using tabulators might look strange.
Indentation
Indentation size is always 2 space characters per level.
Newlines
Newlines are set as it is done by most Object Pascal programs. Between subroutines are two newlines used to separate them.
Misc
Please note that the else in consecutive ifs isn't indented:
if ... then else if ... then else if ... then
Examples
How it looks like can be easily checked by having a look at the FPC sources.