FORTRAN-rules



next up previous contents
Next: Naming of SUBROUTINES Up: ALEPH Programmers hints Previous: ALEPH Programmers hints

FORTRAN-rules

The program shall follow the rules given by the standard ANSI FORTRAN77. Additional rules are checked by the FLOPPY program of J. Bunn [5]

Deck structure:

FORTRAN rules to be followed and checked by FLOPPY: (The numbering as used by FLOPPY)

No.1,11 Avoid comment lines outside module
No. 39  Order of statements should be:
                1. PROGRAM, FUNCTION, SUBROUTINE
                2. PARAMETER, IMPLICIT, COMMON, REAL, INTEGER,..
                3. DATA
                4. Statement function declarations
                5. ENTRY, FORMAT, Executable statements
                6. END statement

Common blocks

FORTRAN rules to be followed and checked by FLOPPY: (The numbering as used by FLOPPY)

No.  4  Variables in COMMON should be ordered according to their word-length
        (i.e. COMPLEX and DOUBLE PRECISION first)
No.  5  COMMON block definitions should not change
No. 18  Avoid multiple COMMON definitions per line
No. 19  Do not dimension COMMON variables outside COMMON

Names of variables,subroutines,functions and commons

FORTRAN rules to be followed and checked by FLOPPY: (The numbering as used by FLOPPY)

No.  7  Variables in COMMON should be 6 characters long
No. 43  Variables (not COMMON, not PARAMs) should be <6 characters
No.  9  Integer variables should begin with I to N
No. 10  Variable names should not equal FORTRAN keywords
No. 12  Module names should not equal intrinsic functions
No. 32  COMMON block names should not equal variable names
No. 34  Avoid FUNCTION names the same as intrinsics
No. 36  Module names should all be different
No. 41  Names used in Statement Function definitions should not be used
elsewhere

Comments

FORTRAN rules to be followed and checked by FLOPPY: (The numbering as used by FLOPPY)

No. 14  Module should begin with at least 3 comment lines
No. 15  Comment lines should begin with a C
No. 16  No comment lines between continuations
No. 40  Separate Statement Functions by comment lines

Coding Style

FORTRAN rules to be followed and checked by FLOPPY: (The numbering as used by FLOPPY)

No. 17  Avoid non-standard variable types eg INTEGER*2
No20,21 Avoid embedded blanks in variable names or syntactic entities
No. 22  Avoid the use of PRINT statements (use WRITE)
No. 23  Do not give the END statement a label
No. 24  Avoid WRITE(* construction
No. 26  Avoid the use of PAUSE statements
No. 27  Statement labels should not begin in column 1
No. 28  Always precede STOP by a descriptive WRITE
No. 37  Avoid expressions of mixed mode eg A=B/I
No. 42  Use LLT,LGT etc to compare CHARACTER vars. in IFs

SUBROUTINES and FUNCTIONS

FORTRAN rules to be followed and checked by FLOPPY: (The numbering as used by FLOPPY)

No. 29  Avoid the use of ENTRY in FUNCTIONS
No. 30  Avoid using I/O in FUNCTIONs
No. 31  Avoid the use of the alternate RETURN statement
No. 33  Avoid use of obsolete CERN library routines
No. 38  Length of passed CHARACTER variables should be *
No. 44  Passed arguments should be dimensioned * in module



Eric Lancon
Thu Sep 29 15:07:07 MET 1994