I am reading some notes from a course in numerical analysis for physical sciences and it is my impression that there are still people that prefer Fortran 77 over new version due to the implicit declaration of memory and control over the use of the memory. But I am not really familiar with Fortran my question is then why it looks that even young scientists prefer Fortran 77 when coding numerical linear algebra methods my question is why? is there a true advantage in using Fortran 77 over the latest versions?


3 Answers 3


I think it's generally true that there are no advantages of Fortran 77 over either newer versions of Fortran or in fact any number of other programming languages that are widely used in scientific computing.

The reason it's still used is because there are millions of lines of code around that are written in Fortran 77. Now, recall that it takes a good programmer a year to write 20,000 lines of code. So converting existing codes to other programming languages is just not an option. Even just to refactor Fortran 77 to newer Fortran styles is not feasible. And so people deal with it.


In general the features that are being removed from the language are either pointless or dangerous, so I'd definitely recommend you may sure you write new code to compile under a later standard, even if you are using syntax supported in the old standard. However one key area where there is still some incentive to write code that is "FORTRAN 77-like" is when interoperability with C is a consideration, as it often will be for library codes for numerical methods. Although the ISO C bindings are good (and I would highly recommend anyone writing interoperable Fortran code to learn and use them in preference to tricks that work with one compiler), it's still often necessary to pass the size and shape of arrays explicitly from one side of the fence to the other.

The net result of this is large, confusing, interfaces to functions etc, rather than the clean, simple to understand (and get right) approach favoured by the later, more object oriented language standards. I'm hopeful this will improve in the future, with the latest work on passing array descriptors C being implemented, but it doesn't seem to be there yet.

Finally, it's somewhat reassuring to note that FORTRAN 77 was a subset of valid Fortran 90, so that the code is only a quarter of a century behind the new fashion, rather than a third.


1) For a long time writing explicitly loops was more efficient than using array syntax because array syntax used a lot of intermediate copies of arrays. Today, this is not true any more, but many Fortran practitioners (like me!) have taken the habit to avoid array syntax because of performance issues.

2) Using pointers makes the code more difficult to optimize by the compiler, and pointers are inexistent in F77.

3) When all the array dimensions are known at compile time, the compiler can do many more optimizations than when the arrays are allocatable. So there is also a performance gain using statically-sized array. For example, the address calculation in multi-dimensional arrays can be done at compile-time avoiding a lot of integer multiplications.

4) Generally the F77 style is such that the compiler has much more hints on how many cycles loops will do, as many dimensioning variables are given in parameter. When everything is dynamic, this information is missing.

5) For some time, dot_product and matmul were known to produce inefficient binary code with usual compilers. Fortunately this is not true any more.

To summarize, I would say that F77 is so old and simple that compilers can generate super-fast binaries. But for modern Fortran, the language is more complex, so it is more difficult to optimize and it takes some time for the compilers to catch up.

  • 4
    $\begingroup$ Even for F77, there no longer is a performance advantage over corresponding C or C++ code. Compilers for C/C++ have generated equally good code for at least a decade. $\endgroup$ Commented Dec 8, 2017 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.