Reputation: 5895
I am working on a project that was given to me by someone else. This project compiles using the ifort
compiler and contains a ton of fortran .FOR files written in seemingly free- format. Recently I have been studying fortran code formats in a little more detail and came accross this article which states:
".f90 specifies Fortran free-form source and .f, .ftn, or .for specify fixed-form souce"
I don't understand why and how these .FOR files can compile OK if they are written in free form, and if ifort recognizes them as fixed form. Could anyone please fill me in on this? I'm trying to migrate this project to gfortran so I'm very confused. Also I do not want to change everything to .f90 files because I am worried this might break something else.
Upvotes: 1
Views: 340
Reputation: 60058
Free form source code can be stored and compiled in files with various extensions. If it is not the default extension, the compiler must be instructed to treat it as fixed form.
In Intel Fortran such flag is -free
or the Windows equivalent /Qfree
. In gfortran it is -ffree-form
, so
gfortran -ffree-form source.for
compiles the .for
file as free form.
Upvotes: 1