Re: upgrading



On Apr 11, 6:33 am, "Zak" <b.zaryc...@xxxxxxxxxxxxxx> wrote:
Hello all,

I have sizeable numerical code that was originaly written to the f77
standard, It has been rewritten in parts to f90 standard. I have a
mild interest in bringing the code up to f95 standard.

I have a couple of questions

Is this actually worth the bother ?

That depends on the programmer and the code. The question of whether
to use Fortran 77 or later versions of Fortran has been discussed many
times here. Let me tackle the narrower question of whether to use
Fortran 90 or 95.

Most compilers that are actively developed and supported are Fortran
95 compilers, so a lack of compilers is not reason to avoid F95.

The FORALL construct of F95 can be convenient, but it certainly not
essential, and some messages here indicate that ir is rarely used in
production code.

I have not found the ability to declare functions and subroutines PURE
in F95 to be very helpful. It's like programming in a straitjacket,
since one cannot print error messages or terminate the program within
the procedure, if an error occurs.

I *do* find user-defined ELEMENTAL subroutines and especially
functions to be useful. To get the same effect in F90 -- the ability
of a single function to handle arguments of varying ranks -- one would
need to write an INTERFACE with MODULE PROCEDURES and write some
duplicative code within the MODULE PROCEDURES. ELEMENTAL functions are
also PURE, but they have advantages to offset their constraints.

There are some convenient enhancements to the edit descriptors in F95.

CPU_TIME is convenient.

By using strict F95 you will be forced to change DO loops with non-
integer loop variables, which is probably a good thing.

The expanded functionality of ALLOCATABLE arrays in an update to F95
(present in F2003 also) is useful.

To sum up, I'd say use F95 over F90 in new code, but if a code uses
the modern features of F90 and works, I don't think the upside to
adding F95 features is that great. An exception may be replacing
POINTERs with ALLOCATABLE arrays where allowed by extended F95.

If one were to decide to rewrite to f95 standard are there any
programing tools freely available to aid in such a task ? (I use the
emacs editor)

I don't know if a tool is necessary. Just compile with more than one
F95 compiler (gfortran and g95 are free) in strict F95
mode -- for those compilers the option is std=f95.



.



Relevant Pages

  • Re: matlab to fortran
    ... the differences between f90 and f95 being pretty minor. ... but there are one or two exceptions. ... compilers might happen to implement i0 anyway. ...
    (comp.lang.fortran)
  • Re: What can be done in FORTRAN that cannot be done in C/C++?
    ... In my formal comments on f90, ... Perhaps the standard could require compilers to have both ... switch separate from the code). ...
    (comp.lang.fortran)
  • Re: Fotran 2003 Compiler
    ... > know the standard has not been ratified. ... official definition of compliance for F90. ... Compilers are complex programs ... The F03 standard is a significant increase in the complexity of the ...
    (comp.lang.fortran)
  • Re: I know this has been discussed before, but...
    ... If the standard does not allow this code, ... I know that there was an F90 or F95 interpretation about this very subject many years ago. ... When I want that value, I typically used hexadecimal notation extensions, but on those compilers that didn't support that, I had to use a large negative integer. ...
    (comp.lang.fortran)
  • Re: 0.0**0 = ?
    ... > therefore appear that the standard prohibits it... ... That quote is not in f95 or f2003 (and I think a corrigendum removed it ... Note that this wording refers to "the arithmetic used by the ... Old standards (f77 and at least the first printimg of f90) did. ...
    (comp.lang.fortran)