Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note:  If you would like to convert old code to follow this style, do that in a dedicated feature branch that ONLY does style changes.  Do not mix style updates with other feature development because it will complicate review.

Table of Contents

Fortran Standards

Official home:  https://wg5-fortran.org/

The committee that defines the standards:  https://j3-fortran.org/

Modern language features (classes)

Do not use modern approaches for abstraction, such as classes. Current OpenACC/OpenMP implementations do not play well with Fortran classes, so we should avoid using these for anything that we think might need to be ported in the future. But in general, it is probably best to avoid their use for this project, and favor more fundamental data structures.

Basic derived types appear to be fine, but using type-bound procedures are not.

In general, you should never use features that are new in the latest Fortran standard.  It takes a long time for compilers to implement them correctly and even longer from them to perform well.

Line width

Source code lines should not exceed 100 characters in length.
Once a line reaches 100 characters, it should be split into multiple lines with a continuation character. This rule applies to comment lines as well.

...

if (crm_ny.eq.1) then
   crm_angle(:ncol) = pi/2.
else
   crm_angle(:ncol) = 0.
end if


Other Sources