"d"为第一栏中的标签Fortran 77 [英] "d" label in the first column, Fortran 77

查看:114
本文介绍了"d"为第一栏中的标签Fortran 77的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从用Fortran 77编写的模型中修改代码,但是我遇到了一件奇怪的事情.在某些文件中,一行的第一列中有一个标签"d",如下例所示:

I am modifying a code from a model written in Fortran 77, but I have come across an odd thing to me. In some files, there is a label "d" in the first column of a line, like the example below:

d     real*8    co2rootfix,co2rootloss,co2shootfix
d     character komma*1

d     open(unit=87,file='crop_CO2.csv',status='unknown')
d     write(87,*) 'date,co2rootfix,co2rootloss,co2shootfix'
d     open(unit=88,file='crop_dm.csv',status='unknown')
d     write(88,*) 'date,wrtpot,wrt,wstpot,wst,rdpot,rd,laipot,lai,
d    &gwrt,gwst,drrt,drlv,drst'

奇怪的是,它已被Intel的ifort编译器成功编译.但是,gfortran在逻辑上返回以下错误:

The weird thing is that it is successfully compiled by Intel's ifort compiler. However, gfortran logically returns the following error:

错误:语句标签(1)处的非数字字符

Error: Non-numeric character in statement label at (1)

我想知道:

  1. 该标签的含义;
  2. 为什么只能被ifort和识别?
  3. 我如何使其与gfortran一起使用.

推荐答案

在ifort文档中,有选项-d-lines-nod-lines:

From the ifort documentation there are the options -d-lines and -nod-lines:

此选项编译调试语句.它指定在固定格式文件中的第1列(调试语句)中包含D的行应视为源代码.

This option compiles debug statements. It specifies that lines in fixed-format files that contain a D in column 1 (debug statements) should be treated as source code.

因此,如果代码是在没有-d-lines(或默认为-nod-lines)的情况下编译的,则第一栏中带有d的行将被视为注释并被忽略.

So, if the code is compiled without -d-lines (or with -nod-lines which is the default) then those lines with d in the first column in treated as comments and ignored.

在gfortran中,-fd-lines-as-code-fd-lines-as-comments具有相同的效果.此处的区别在于,ifort作为扩展名,不考虑标志而接受代码(如上所述,它具有隐式的-nod-lines). gfortran要求确切指定其中一个标志以接受代码.

In gfortran -fd-lines-as-code and -fd-lines-as-comments have the same effect. The difference here is that ifort, as an extension, accepts the code regardless of flags (as above, it has the implicit -nod-lines). gfortran requires exactly one of the flags to be specified to accept the code.

这篇关于"d"为第一栏中的标签Fortran 77的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆