SHARED option in OPEN Statement in the Fortran standard

佐手、 提交于 2019-12-02 08:49:19

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/33245989/shared-option-in-open-statement-in-the-fortran-standard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!