linux f95编译器,gfortran如何告诉我是否正在编译f90或f95代码?

gfortran可以从文件扩展名中猜出某些东西;如果文件的扩展名为.f,.f90,f95,.f03或.f08,则它将采用具有适当标准的固定(.f)或自由格式。但你可以强制它使用选项-std = f2003编译(比方说)fortran2003代码。例如,来自documentation,

-std=std

Specify the standard to which the program is expected to conform,

which may be one of `f95', `f2003', `f2008', `gnu', or `legacy'. The

default value for std is `gnu', which specifies a superset of the

Fortran 95 standard that includes all of the extensions supported by

GNU Fortran, although warnings will be given for obsolete extensions

not recommended for use in new code. The `legacy' value is equivalent

but without the warnings for obsolete extensions, and may be useful

for old non-standard programs. The `f95', `f2003' and `f2008' values

specify strict conformance to the Fortran 95, Fortran 2003 and Fortran

2008 standards, respectively; errors are given for all extensions

beyond the relevant language standard, and warnings are given for the

Fortran 77 features that are permitted but obsolescent in later

standards. `-std=f2008ts' allows the Fortran 2008 standard including

the additions of the Technical Specification (TS) 29113 on Further

Interoperability of Fortran with C.

请注意,除少数例外情况外,fortran标准具有高度向后兼容性,因此很多“漂亮”,符合标准的fortran-77代码也是有效的fortran 2003代码。与此相关的主要问题是80年代及更早版本的大量代码既不“好”也不符合标准。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值