Hi Neil,
Neil N. Carlson wrote:
> I'd like to hear what others think about a curious issue I stumbled
> across. What should the value of YESNO be in the following cases:
>
> A. open(unit=1,file='junk',form='formatted')
> inquire(1,unformatted=yesno)
>
> B. open(1,file='junk',form='unformatted')
> inquire(1,formatted=yesno)
>
> For some Fortran compilers under Linux I get the following results:
>
> G95 GFORTRAN Intel Pathscale PGI Lahey NAG
> ---------------------------------------------------------
> A YES YES NO NO NO NO UNKNOWN
> B YES YES NO NO NO NO NO
>
> I've taken a look at the standard (9.4.5, 9.9.1.12) and I'm
> not sure how to interpret what is meant by the "set of allowable
> forms for a file".
First, I believe this is a functionality which is rather useless as it
is unclear what exactly should be returned. YES/YES is equally right and
wrong as NO/NO; the only completely right answer would be
UNKNOWN/UNKNOWN. (There might be systems where YES or NO is known for
sure; but not on the systems I know.)
The gfortran/g95 point of view is: You can surely open the file as
(un)formatted; whether it makes sense to open an unformatted file as
formatted is another question; but for (over)writing this is surely
possible and thus the answer makes sense.
The view of intel/pathscale/PGI/Lahey seems to be: If I opened a file as
formatted (unformatted), it is unlikely that one can get anything useful
out of it when opening it as unformatted (formatted).
Both point of views are (more or less) valid - and both answers don't
help (in practice).
See also Richard Maine's reply to a similar question of mine at
http://groups.google.com/group/comp.lang.fortran/msg/b2ab0a6e106d977c
Tobias
|