New features of Fortran

Hi everyone,
Glad that Fortran is again picking up with introduction of new features, fpm, stdlib and so on…
I am a newbie to Fortran 2003 and up. I learned up to F90 (excluding pointers). I have a few questions regarding the features that Fortran has been implementing in the past few releases.

  1. Since in Fortran everything “passes by reference”, why pointers are introduced in F90 ?
  2. Why interoperability with C was considered among other languages…?
  3. Is there any standard resource which helps us migrate gradually from F90 to Modern Fortran…?
  4. Can I call my F77 ‘SUBROUTINES’ from Modern Fortran ? If yes how?

I am sorry if these question are most obvious ones… but I think here is where all the giants of Fortran meet together so I considered it would be best place to get answer from.
Basically I come from Finite elements background - in Structural Engineering…

Thank you,

1 Like

Welcome @Ashok to the Fortran Discourse! All questions are welcomed.

Concerning 2., the C language was created in the early 70’s for (re)writing the UNIX system and remains nowadays the king for that kind of application. Many libraries are written in C. If you want to make a GUI for a Fortran program, GTK is written in C (but Qt in C++). If you need to interface with a database, SQlite is written in C. By interfacing with C libraries, you can access nearly all the features that you missed in Fortran.


Regarding (1), note that Fortran 2003+ has the VALUE attribute. In Fortran 90, procedures could not have ALLOCATABLE arguments, and derived types could not have ALLOCATABLE components, but one could use POINTERs instead. Those restrictions have been lifted, and POINTERs should no longer be used for those cases. If you repeatedly refer to an array section, for example x(:,:,i) you can define a pointer that refers to the section, for convenience. Now, using ASSOCIATE is recommended.

Vmagnin answered (2). I will add that since almost everything is interoperable with C, C interoperability allows Fortran to access a wide range of languages.

Regarding (3), are you really using strict Fortran 90? What compiler are you using? The books by Brainerd and Curcic are approachable.

Regarding (4), certainly yes. For the most part, Fortran 77 code is valid modern Fortran code with the same meaning. If you have a problem, please post the code.


You will find here resources to learn Fortran:
Modern Fortran of course! I don’t know if there is an official definition of what is “Modern Fortran”. Arthur Rimbaud wrote in 1873: “One must be absolutely modern”. In 1957, FORTRAN was “absolutely modern”, and still is. Personally, I would say that Modern Fortran begins with Fortran 90/95. So beginning with F90 is a good point, you will just have to learn more recent features, and correct a few habits concerning some deprecated features.

1 Like
  1. Since in Fortran everything “passes by reference”, why pointers are introduced in F90 ?

This is a common misconception. Fortran does not mandate “pass by reference”, it mandates semantics that nail down what a) the user can expect to happen to their variables across a standard conforming call and b) what the user must not cause to happen. How that is actually done is not specified.

Fortran pointers are not like C pointers. Effectively, Fortran factored the C concept of pointer into (array * allocatable * pointer) and gave each a role. That way, the programmer can use a) the safest concept for the application and b) the most performant code style.

  1. Why interoperability with C was considered among other languages…?

C is regarded as the de-facto system lingua franca. If you can interface to C, you can interface to anything else.

  1. Is there any standard resource which helps us migrate gradually from F90 to Modern Fortran…?

I recommend the articles by John Reid titled “New features of Fortran”.

  1. Can I call my F77 ‘SUBROUTINES’ from Modern Fortran ? If yes how?

Yes. The way I would do it is generate interface blocks for them and put these blocks in a module which you USE in any subprogram that calls the subroutines. Be prepared for error messages from the compiler when it notices that you have been abusing Fortran all this time!


Thank you Beliavsky,
Yes, I was using Fortran 90 from a book by an Indian author. That book just makes the transition from F77 to F90 Fixed to Free form code and some other features like allocatable arrays… It doesn’t explain about other features.
I am using intel compiler.

Thank you vmagnin,
I also dream of a best practices guide for Modern Fortran. Because there is a lot of “you can do this also” in Modern fortran. Some best practices guides like those of “Effective C++” by Scott Meyers will shape the language is a good direction. I feel we have to learn from C++ - there is a lot of bad code by poor programmers. “Power comes with responsibility”. These poor programmers have brought a lot of bad reputation to the language itself. I think best is be careful from the beginning itself.

Welcome to the Discourse @Ashok !

To add the very helpful replies post above, pointers are useful for a wide variety of things beyond handling and passing arrays; in particular there are data structures such as linked lists that are typically implemented using pointers. However one of the reasons I like Fortran is that pointers are not necessary for the vast majority of my typical use cases.

1 Like

Please see the Free Style Guide thread.

Personally, I would also recommend that book:
Clerman, N. S. and Spector, W. . 2011. Modern Fortran: Style and Usage . 1st ed. Cambridge. Cambridge University Press

(and not only because I like the cover :wink:)

You can read some pages here:


Welcome. Lots and lots of excellent advice and suggestions for you thus far. You may also keep in mind the Fortran Wiki site for information: Fortran Wiki

If you’re seeking an easily accessible step-by-step introduction that can help you get going with commonly used features up to Fortran 2008, this guide is rather good: Introduciton to Programming using Fortran 95/2003/2008

Note the book by Clerman and Spector on “Modern Fortran: Style and Usage” is excellent. It provides a lot of details on modernizing legacy FORTRAN code in addition to good practices in new code. So does the book by Hanson and Hopkins: Numerical Computing With Modern Fortran (Applied Mathematics): Richard J. Hanson, Tim Hopkins: 9781611973112: Books

And given your background in Engineering, the book by Chapman is also useful: Fortran for Scientists & Engineers, Chapman, Stephen, eBook -

1 Like

Thanks to everyone. Such an active and helpful community…


I have just read in that page Fortran 2018 in Fortran Wiki :

Fortran 2018 is a minor revision of Fortran 2008.

Isn’t it a major revision? (60 more pages in the Metcalf/Reid/Cohen book).

1 Like

A major revision will effectively have an entire book to describe the semantics and syntax, the last such being Fortran 2003: The Fortran 2003 Handbook - The Complete Syntax, Features and Procedures | Jeanne C. Adams | Springer