next up previous contents index
Next: 5.3 Naming conventions Up: 5.2 Indentation and spaces Previous: 5.2.3 Normal code indentation   Contents   Index

5.2.4 Further recommendations

To save space for the alignments of assignments, headers of files, modules, subroutines, or programs should not be indented.

Usually, there should be no blanks around the ``='' in an assignment. However, in some cases they can be inserted to improve readability. Likewise, a blank after a comma in parameter lists is inserted in some but not all cases.

In if..then..else constructs, the new comparison operators are preferred ober the old ones, i.e. ``=='' instead of ``.eq.''. A single space is used before and after the comparison operator. The general outline should be

  if (Copyrho_flag) then
  if (time_flag > 0) then
  if (ierr /= 0) then
  if (model%n1 == model%m1) then
The use of possibly redundant brackets is encouraged as in
  if ((par%OutFile_full /= '') .or. (par%OutFile_mean /= '')) then
  if ((par%A%hdScheme == hdScheme_RoeWave  ) .or. &
      (par%A%hdScheme == hdScheme_RoeState ) .or. &
      (par%A%hdScheme == hdScheme_RoeMagKin)       ) then
  if ((ierr > 0) .and. (ierr < 100)) then

There is no space between subroutine of function name and following open bracket.


next up previous contents index
Next: 5.3 Naming conventions Up: 5.2 Indentation and spaces Previous: 5.2.3 Normal code indentation   Contents   Index