Fortran标准中OPEN语句中的SHARED选项 [英] SHARED option in OPEN Statement in the Fortran standard

查看:335
本文介绍了Fortran标准中OPEN语句中的SHARED选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本文档中, HP Fortran文档中,OPEN语句接受SHARED和READONLY选项。

在本文档中标准Fortran 2008文档,OPEN语句不接受SHARED或READONLY选项。

由于我使用 gfortran <在Linux上使用 gcc 4.4.7 来编译一个Fortran源代码文件,我用一个诡计解决了一半的问题。我用

  OPEN(...,ACTION = READ,...)而不是READONLY。 

但是找不到另一个ruse(:)来取代SHARED Option。 (就像 Something = Shared )。

任何人都有一个诡计,以获得周围?这些IO扩展(SHARED,READONLY等)以及其他扩展(如在基于DEC的Fortran中可用的)应该是可用的。
通过-fdec和相关的编译器开关在GCC / gFortran中可用。然而,我在在线GCC文档中发现了一些混淆。显然,一些老版本的gFortran(特别是g77)可能需要使用libf2c元素来编译编译器,并且在Unix上可能会有差异(比如Win等)。

现在还不清楚哪个版本的gFortran接受这个。例如,在Windows下,使用GCC / gFortran 6.x,它不会识别-fdec开关。



显然,GCC / gFortran v7.x那工作,但V7仍处于发展模式...你感到幸运:-)?

另外,一些参考文献给出了关于依赖扩展



以下是一些有趣的页面:

https://gcc.gnu.org/wiki/GFortran/News



https://gcc.gnu.org/onlinedocs/gfortran/Extended -I_002fO-specifiers.html



https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html



https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html



最后一个链接似乎特别可怕的主题。


In this documentation HP Fortran doc, the OPEN statement accept SHARED and READONLY options.
In this documentation Standard Fortran 2008 doc, the OPEN statement dosn't accept SHARED or READONLY options.
Since I'm using gfortran comes with gcc 4.4.7 to compile a Fortran source file on Linux,I used a ruse to get around half the problem. I used

 OPEN(...,ACTION=READ,...)  instead of READONLY.

But can't find an other ruse (:)) to replace SHARED Option. (Like Something=Shared).
Anyone have a ruse to get arround that?

解决方案

Those IO extensions (SHARED, READONLY, etc) as well as other extensions, as would be available with DEC based Fortran should be available in GCC/gFortran via the "-fdec" and related compiler switches.

However, I found some confusion in the online GCC docs. Apparently, some older versions of gFortran (and in particular g77) may require the compiler to have been built with the libf2c element, and there may be differences on Unix (c.f. Win etc).

It is not clear exactly which versions of gFortran accept this. For example, under Windows, with GCC/gFortran 6.x, it would not recognise the "-fdec" switch.

Apparently, GCC/gFortran v7.x have all that working, but v7 is still in "development mode" ... are you feeling lucky :-) ?

Also, some references give dire warnings about reliance on "extensions".

Here are some pages of interest:

https://gcc.gnu.org/wiki/GFortran/News

https://gcc.gnu.org/onlinedocs/gfortran/Extended-I_002fO-specifiers.html

https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html

https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html

The last link seems particularly "dire" on the subject.

这篇关于Fortran标准中OPEN语句中的SHARED选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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