Silverfrost Forums

Welcome to our forums

Fixed form, '!' in column 6

3 Mar 2021 12:23 #27199

I find myself working with a package written in Fortran 77 in the 1990s, and it uses an exclamation mark in column 6 to indicate continuation. The Fortran standards explicitly permit this. The Fortran 95 standard, for instance, says in 3.3.2.1:

The character '!' initiates a comment except when it appears within a character context or in character position 6.

FTN95, in contrast, treats a fixed form source line with blanks in columns 1-5 and a '!' in column 6 as a comment. Thus

      subroutine BasInf(KAT,MaxIt,TolTh,TolH,lWat,lChem,AtmInF,ShortF,
     !                  SeepF,CheckF,FluxF,FreeD,DrainF)

gives rise to the continuation line being treated as a comment, hence giving rise to a syntax error.

3 Mar 2021 3:40 #27200

Why would they write code like that in 1990's ? Too smart by half !

3 Mar 2021 8:12 #27201

mecej4

Thanks for the bug report. I have made a note that this needs fixing.

3 Mar 2021 10:13 #27202

Quoted from JohnCampbell Why would they write code like that in 1990's ? Too smart by half !

Many such packages, often from govt. research organizations, were originally written in Fortran-66, then moved to Fortran 77. Fortran 90 had a very long gestation period, and the first Fortran 90 compilers yielded such slow executables that users stuck to Fortran 77 well into the 1990s. The exclamation mark was not used to start in-line comments in the older Fortrans and those did not provide for inline comments. The exclamation mark was not part of the Fortran-77 character set.

30 Mar 2021 9:19 #27363

This has now been fixed for the next release of FTN95.

Please login to reply.