Approximatrix, LLC

Download! Purchase!

Detecting Fixed-Format Fortran

Posted on 2017-07-07

A common question we regularly receive is the substantial errors resulting from attempting to compile fixed-format Fortran source code using the extension .f90 for the source file. Simply Fortran's compiler, in these cases, emits countless, undecipherable errors that provide almost no hints that the user has saved his or her file using an incorrect extension. This confusion is the result of a language that effectively allows two separate syntaxes.

Simply Fortran, in our opinion, rightfully assumes most users wish to start new projects using free-format Fortran, the most common syntax for programming in the Fortran 90 and later standards. Similarly, existing legacy code will most commonly be stored in files using the .f or .for extensions, which Simply Fortran and its compiler correctly recognize.

A problem arises, however, when someone either copies and pastes legacy code or starts a fresh fixed-format Fortran source file in Simply Fortran. Our default editor mode and file-saving extension assume the user is starting with free-format Fortran. New users unfamiliar with Simply Fortran will end up saving, for example, "textadv.f90" containing valid fixed-format Fortran. When the user attempts to compile this code, our compiler effectively generates useless errors that don't alert the user that the file should have a different extension.

Simply Fortran version 2.38 attempts to eliminate this mystery for new users. When the compiler fails in certain ways, Simply Fortran should now notice these indicative errors and alert the user appropriately:

Fixed-Format Warning

When the user clicks "Yes," his or her file will be renamed with the proper extension automatically. Additionally, the project references to the file will be updated so that the project now references the renamed file.

An integrated development environment should make a user's life easier while programming, and this feature definitely eliminates a common and major source of confusion. This feature will be available for all platforms when version 2.38 is released (we're still finishing up testing).

Users with other pain points should always contact us, either on the forums or directly. We're always looking to improve Simply Fortran for the benefit of our community.

Back to the Blog...