[This document will be continually updated.]
![]()
Here follows some random observations on Fortran 90. They are not particularly astute, but are made public in the hope of stimulating some thought in this area.
But Fortran has moved on with Fortran 90 well-established, and even rumours of a Fortran 95 ;-) Fortran 90 includes new control structures (e.g. SELECT CASE), user-defined data types (cf. structs in C), whole array notation (a = b + c where a,b,c are arrays), modules (MODULE, USE), dynamic memory allocation (ALLOCATE, DEALLOCATE) plus more. Wouldn't it be nice to use these extra features?
Well, yes, but while there are many Fortran 90 compilers out there, they are not installed on all systems. In particular, there is no GNU g90 (although Pacific-Sierra Research offer a Linux VAST/f90 Fortran 90 compiler free for personal use, and Lahey apparently supply a command line version for free). Distributing Fortran 90 code would therefore cause problems for many users. It should also be mentioned that compiled Fortran 90 code is reported to be a little slower than the Fortran 77 equivalent, although this of course depends on the particular code and compiler.
Anyway, the first step in migrating to Fortran 90 is testing that the current code compiles under f90. Since Fortran 90 is supposed to be backwardly-compatible to Fortran 77 it should. Here's the first test ....
Compiling the library brought up 2 problems:
With the library compiled, there were no problems compiling the programs in $CCP4/src and $CCP4/unsupported/src Well actually, f90 fell over on getax.f, dmmulti_/dmmulti_dmaver.f, refmac_/lsq.f, sftools_/sftools.f but these were due to coding mistakes rather than language problems.
At runtime, the programs gave out incomprehensible warnings, which seem to arise from the -trapuv a.k.a. -DEBUG:trap_uninitialized=ON compiler option. Otherwise, the programs I tried gave the same results as those compiled by f77.
Specifically, with g77 version 0.5.21 I found: