如何使用gfortran for Fortran 90和.for文件扩展名? [英] How to use gfortran for Fortran 90 with .for file extension?

查看:1383
本文介绍了如何使用gfortran for Fortran 90和.for文件扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu(16.04)中安装Gfortran后,指向f95。我在gfortran手册中看到-std选项可用于f95和forward。我从手册中看到的默认 -std 选项值是gnu。如果我使用f95作为f90代码,我不确定编译内部的影响。



如何将gfortran用于扩展名为.for的Fortran 90文件?我不想将Fortran 95编译器用于Fortran 90代码,尽管Fortran 95可能能够(不确定)编译Fortran 90.

解决方案

Fortran 90已经死了。它存在严重的缺陷,特别是在可分配的情况下,由Fortran 95固定。例如,它允许存在未定义的分配ststus。

很多时候有人说他在使用Fortran 90,他实际上在使用别的东西。



Fortran 90和Fortran 95非常接近,甚至没有选择在编译器中启用Fortran 90。它主要是在标准中启用这些错误和疏忽,并禁用一些功能。



Gfortran,默认模式 gnu 实际上接近Fortran 2003或2008编译器。某些默认设置与Fortran 90和95不同。例如,分配时自动重新分配。但对于Fortran 90和95中的程序以及77中的某些程序来说,它通常是有益的。它可以对标准进行某些常见的扩展。 Certsin较少见的扩展可以通过特殊标志来启用。



没有理由担心。 Fortran 95是标准的人应该关心的。 Fortran 90不是。



关于.for扩展名,如果编译器符合固定格式源,无论是77,90,95,2008, 。


After I installed Gfortran in Ubuntu (16.04) is pointing to f95. I see in gfortran manual that -std option can be given for f95 and forward. The default -std option value I see from manual is "gnu". I am not sure of implications of internals of compiling if I use f95 for f90 code.

How do I use gfortran for Fortran 90 files with .for extension? I do not want to use Fortran 95 compiler for Fortran 90 code though Fortran 95 might be able to (not sure) compile Fortran 90.

解决方案

Fortran 90 is dead. It had serious deficiencies, especially with allocatables, that were fixed by Fortran 95. For example, it allowed existence of undefined allocation ststus.

Many times someone says he is using Fortran 90 he is in fact using something else.

Fortran 90 and Fortran 95 are so close that there is even no option to enable Fortran 90 in compilers. It would mostly just enable those errors and oversights in the standard and disable just a few features.

Gfortran, in the default mode gnu is actually close to a Fortran 2003 or 2008 compiler. Some of the default settings are different from Fortran 90 and 95. For example the automatic re-allocation on assignment. But it is normally good for programs in Fortran 90 and 95 and even some in 77. It enables certain common extensions to the standard. Certsin less common extensions can be enabled by special flags.

There is no reason to worry. Fortran 95 is the standard people should care about. Fortran 90 is not.

Regarding the .for extension, the compiler should process correctly if it is conforming fixed form source, be it 77, 90, 95, 2008, whatever.

这篇关于如何使用gfortran for Fortran 90和.for文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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