Re: io-unit has been opened



Hello,

baf wrote:
Richard Maine wrote:
baf <baf@xxxxxxxxxxx> wrote:

If it is "illegal" to open the same file twice,
It is.

then the Intel Fortran compiler has a bug.
That does not follow. There are many, many things that are illegal for
programs to do, but that compilers are not required to enforce. Indeed
that is the case for the large majority of things in the language. Prior
to f90, that was the case for everything in the language - there were no
requirements for compilers to enforce anything. Diagnostics were purely
a quality of implementation matter.

The illegality of multiple simultaneous opens of the same file just
means that the compiler is not required to make it work. It does not
mean that the compiler is required to make it not work.

I agree with your analysis in general, but not in this case. If I ask
for strict, standards compliance checking from the compiler, and if
opening a file twice with two different units numbers is not allowed by
the F90 standard, then the compiler should indicate that an error has
occurred.

Does the standard specifically say that this action is not allowed?

Yes. Please see _9.4.3 Connection of a file to a unit_ in the standard.

The compiler is required to diagnose failure to adhere to the numbered
syntax rules. It is not required to emit run-time code to catch
errors during execution.

Please see _1.7.1 Applicability of requirements_, specifically
the sentence "Except where stated otherwise,
such requirements and prohibitions apply to programs rather
than processors."

--
Cheers!

Dan Nagle
Purple Sage Computing Solutions, Inc.
.



Relevant Pages

  • Re: io-unit has been opened
    ... The illegality of multiple simultaneous opens of the same file just ... means that the compiler is not required to make it work. ... Does the standard specifically say that this action is not allowed? ... noted as in error at compile time. ...
    (comp.lang.fortran)
  • Re: io-unit has been opened
    ... The illegality of multiple simultaneous opens of the same file just ... means that the compiler is not required to make it work. ... opening a file twice with two different units numbers is not allowed by ... Does the standard specifically say that this action is not allowed? ...
    (comp.lang.fortran)
  • Re: Is C99 the final C? (some suggestions)
    ... > that someone will try compile their stuff on an old compiler. ... > because the ANSI standard obsoleted them, and everyone picked up the ANSI ... fixed by using another language. ... >>are multiplying two expressions of the widest type supported by your ...
    (comp.lang.c)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... Program name in quotes (allowed in '02 Standard) ... > If J can be made an independent item which the compiler can put wherever it ... > has to be associated with a hardware device in SPECIAL-NAMES. ... > that ALTER *always* modifies the address parameter of the hardware branch ...
    (comp.lang.cobol)
  • ANSI C compliance
    ... "My boss would fire me if I wrote 100% ANSI C code" ... standard which is defined by an international committee. ... as intended on all platforms for which you have an ANSI C compiler, ... Writing truly standard C as valued by the "regulars" ...
    (comp.lang.c)