Fortran: difference between f and F extension

后端 未结 4 1575
再見小時候
再見小時候 2021-02-02 16:27

I\'m a bloody beginner in Fortran.

I wonder: what is the difference between the .f and .F extensions of Fortran files. I know that muc

4条回答
  •  攒了一身酷
    2021-02-02 16:59

    In gfortran, free-form (no special meaning for cols 7, 72) is set by the compiler switch -ffree-form and has nothing to do with .f or .F file suffixes. The difference between .f and .F is that the latter goes through a pre-processor, the most common use of which is allowing C-like #define statements. For example:

    #define MAXN 100
    program example
    integer N(MAXN)
    end
    

    will compile if it is .F but not if it is .f

提交回复
热议问题