tags:

views:

221

answers:

2

I have a piece of fortran code, and I am not sure which standard it is - '77, '90 or '95. Is there a standard tool to identify which standard it subjects to?

+1  A: 

If you have access to GNU Fortran (gfortran) you can try compiling it with the different options for --std and see which one works. You can find details on the dialect options here.

tvanfosson
+4  A: 

There probably are automated tools, but my methods are largely heuristic:

  • Do comments use a ! anywhere on the line (F90+) or a C in the first column (F77)?
  • Do loops use do..end do (F90+) or do..continue (F77)?
  • Are lines continued using & at the end of the line (F90+) or in column 6 (f77)?
  • Does the code use module or type structures (F90)?
  • If the code uses arrays, does it operate on them as a single structure (F90) or always using loops (F77)?
  • Is dynamic memory (either using allocatable or pointer methods) used (F90)?

Generally these are enough to discriminate between F90 and F77. The differences between Fortran 90 and FORTRAN 77 are much, much larger than the differences between Fortran 90 and Fortran 95 so I usually stop there.

Tim Whitcomb