Changes between Version 7 and Version 8 of doc/tec/developerrules/palmstandard


Ignore:
Timestamp:
Nov 5, 2018 6:50:45 PM (6 years ago)
Author:
kanani
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • doc/tec/developerrules/palmstandard

    v7 v8  
    11= PALM coding rules =
    2 Why to follow some standards? - Because everyone has her/his own programming style, sort of a dialect. And as it is, no one can understand all the possible dialects. So what do we do? We learn and apply the coding standard to make PALM more easily readable for all current and future developers. Let's all work on that - together.
     2Why to follow some standards? - Because everyone has her/his own programming style, sort of a dialect, making it difficult for other developers to understand, extend, debug, or optimize the code. So what do we do? We learn and apply the coding standard to make PALM more easily readable for all current and future developers. Let's all work on that together. We are aware that the PALM core doesn't completely comply with the following rules yet, but we are working on that.
     3\\
     4Formulated rules and specifications are based on the specifications given for the ocean dynamics model [add-new-link-to NEMO].
     5Other work that influenced the development of this standard are [add-link Community Climate System Model], [add-link Software Developer's Guide], [add-link Report on Column Physics Standards], and [add-link European Standards For Writing and Documenting Exchangeable FORTRAN 90 Code].
    36
    4 == General ==
    5 * Only ASCII characters allowed
    6 * Line length limit: 80 (soft) | 120 (hard)
     7\\
     8== (1) General language & form requirements ==
     9* FORTRAN-2003 standard (all FORTRAN compilers can handle this, FORTRAN-2008 standard not yet supported by all compilers)
     10* Use English language only
     11* Use ASCII characters only
     12* Use SI units as physical units
     13* Line length limit: 80 characters (soft) | 120 characters (hard) --> Optimize readability (FORTRAN-2003 standard allows '''max. 132''' characters)
    714
    8 == Indenting, spaces & line breaks ==
     15|| '''AVOID''' || '''USE INSTEAD''' ||
     16|| COMMON blocks || ... ||
     17
     18\\
     19== (2) Indenting, spaces & line breaks ==
    920'''__General module/subroutine structure'''
    1021(see Fig. 1)
     
    1223#!div style="align:'left'; width: 450px; border: 0px solid; float:right"
    1324[[Image(rules_indent_general.png, 450px, right, margin-right=2, margin-top=0, border=0)]]\\
    14 Fig. 1 Indention example with highlighted whitespaces. Click to enlarge.
     25'''Fig. 1''' Indention example with highlighted whitespaces. Click to enlarge.
    1526}}}
    1627
     
    2536
    2637* '''1 blank line''' between enclosed blocks of instructions, assignments, clauses, statements, etc.
    27 * "&" character for line continuation at position 80 (minimum), max at position 120
     38* '''&''' character for line continuation at position 80 (minimum), max at position 120
    2839
    2940'''__Whitespaces between brackets'''
     
    3849#!div style="align:'left'; width: 450px; border: 0px solid; float:right"
    3950[[Image(rules_indent_loops.png, 450px, right, margin-right=2, margin-top=0, border=0)]]\\
    40 Fig. 2 Indention & whitespaces in loops. Click to enlarge.
     51'''Fig. 2''' Indention & whitespaces in loops. Click to enlarge.
    4152}}}
    4253
     
    4859
    4960
    50 \\\\\\\\\\\\\\\\\\\\\\\\\\
    51 == Alignment ==
     61\\\\\\\\\\
     62== (3) Alignment ==
    5263(see Fig. 3)
    5364{{{
    5465#!div style="align:'left'; width: 450px; border: 0px solid; float:right"
    5566[[Image(rules_align.png, 450px, right, margin-right=2, margin-top=0, border=0)]]\\
    56 Fig. 2 Indention & whitespaces in loops. Click to enlarge.
     67'''Fig. 3''' Alignment example. Click to enlarge.
    5768}}}
    5869* Block-wise alignment of continuation line marker '''&'''
     
    6071* At least block-wise alignment for same type/group of declaration statement
    6172* Alignment of message_string values
    62 * Alignment of input between brackets (e.g. in '''IF (  )  THEN''' or in argument list in subroutine calls)
     73* Alignment of expressions between brackets (e.g. in '''IF (  )  THEN''' or in argument list in subroutine calls)
    6374
    6475\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
     
    7283== Naming conventions ==
    7384
    74 == Operators ==
    75 * e.g. /=, <, <=, ==, >, >=, etc. (not .GE., .LT., etc)
    76 * .AND., .OR., .NOT.
     85== Allowed operators ==
     86* Use /=, <, <=, ==, >, >=, etc. as relational operators instead of .GE., .LT., etc.
     87* Use .AND., .OR., .NOT. as logical operators
    7788
    7889== Preprocessor directives ==
     90
     91== Declaration statements ==
     92* for long lists form groups
    7993
    8094== File header ==
     
    8397* The revisions section will later include short notes of the changes applied to a specific svn revision of this file. The {{{$Id$}}} string is required so that svn knows to generate the respective time stamp for a revision (see existing SOURCE files).
    8498* Finally, involved authors are included, followed by a description of the purpose and functions of the module. If necessary, TODOs, notes and known bugs can be added. The "!>" indicate doxygen-readable comment lines, the "@" marks doxygen variables.
     99
     100== Check compilation ==
     101* no warning/error message should remain