How can gfortran tell if I am compiling f90 or f95 code?

前端 未结 2 1647
逝去的感伤
逝去的感伤 2020-12-08 17:25

I understand gfortran can compile f90 or f95? How does it know which one it is compiling? Also can it compile f77 code? Does ubuntu already have a fortran compiler or do I n

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 17:50

    Yes, gfortran can compile FORTRAN 77 and Fortran 90,95 etc. It has many features of 2003 & 2008 implemented. For Fortran 90/95/2003/2008 code a good extension to use is .f90. Some other compilers don't recognize .f95, .f2003, etc. And do you really want to rename your files when a new standard comes out? Use .f or .for for FORTRAN 77. The main difference is the source layout that the compiler will expect: free form for .f90, fixed form for .f or .for. (Upper-case filetypes will cause the preprocessor to be run.) You can force fixed-form layout with the options -ffixed-form -ffixed-line-length-none.

提交回复
热议问题