Coding Conventions
Revision as of 09:03, 23 January 2007 by Freddie Akeroyd (talk | contribs)
Subroutines Arguments
Subroutines arguments should be arranged in the order:
mandatory [in] (input only) arguments, followed by mandatory [inout] (input and output) arguments, followed by mandatory [out] (output) arguments, followed by optional [in] (input only) arguments, followed by optional [inout] (input and output) arguments, followed by optional [out] (output) arguments
These should them be declared in separate blocks and commented as follows
subroutine test(arg1, arg2, arg3, arg4, arg5, arg6) implicit none ! Mandatory input arguments integer(i4b) , intent(in) :: arg1 !! description of arg1 ! Mandatory input/output arguments integer(i4b) , intent(inout) :: arg2 !! description of arg2 ! Mandatory output arguments integer(i4b) , intent(out) :: arg3 !! description of arg3 ! Optional input arguments integer(i4b) , intent(in) :: arg4 !! description of arg4 ! Optional input/output arguments integer(i4b) , intent(inout) :: arg5 !! description of arg5 ! Optional output arguments integer(i4b) , intent(out) :: arg6 !! description of arg6
Nore that we use !! on the variable description so that is it picked up by F90DOC