wiki:FpCodingStandard

FLEXPART Coding Standards

  1. Explain all variables you use in writing (as comment)
  1. Comment all code
  1. As much as possible, integer variables should have names starting with i,j,k,l,m,n, and don't use real variable names with these initials.
    Typically, i and r or x can be placed in front of any other name to make it conform this specification.
  1. Use indentations for loops, if-statements, etc.
    • From start till end of loop, all code lines should be indented by 2 spaces;
    • nested loops should have multiple indentations so that the looping level is always clear.
    • Indenting by whitespace only, not tab characters (check your editor settings!)
    • Continuation lines can be indented by >2 chars, 3 is preferred
    • long DO .. END DO loops should in addition be named so that the matching END DO is easly identified
    • we use ELSEIF and ENDIF (written together) but END DO (maybe unify later)
  1. Variables that are passed between subroutines should be marked in the subroutine as input (i), output (o) or both (i/o) when values are changed both in the subroutine and in other routines. This should be done just below the subroutine statement. Again, this has become a mess because of the automatic transcription. We will try to make it systematic again.

Is it also acceptable if an INTENT keyword is present in the declaration section?

  1. If you make changes in a subroutine, explain them in the header: Who? Why? What? When?

For a sample header file, see FpCodingStandardSampleHeader

Last modified 3 years ago Last modified on Jul 3, 2015, 3:37:24 PM
hosted by ZAMG