Re: closing unit=5 and unit=6 and print *



robert.corbett@xxxxxxx wrote:
Richard E Maine wrote:

1. The standard didn't actually say anything like that. There is a
bit that could possibly be misinterpreted that way, but I believe
that would be a misinterpretation... and the formal interp agrees
with me. You are probably reading the part that says that a file may
not be connected to more than one unit at the same time. The subtle
part is in the distinction between a unit and a unit identifier; the
standard is a bit sloppy about that distinction, but I maintain that
* and 6 (for example) can be two different identifiers for the same
unit, just like two different integer variables with the same value
could identify the same unit. I agree it is a subtle distinction.

I don't believe that subtle distinction is strong enough to allow what
DEC, Cray, and now Sun do. Suppose * and 6 (for example) are
two different identifiers for the same unit. Then closing the unit
idenitified by 6 should close the unit idenified by *, and that does
not happen for those implementations. I could weasel-word my
way around that, but if 6 is used to identify a unit in a subsequent
OPEN statement, it does not change the connection for * in those
implementations. I see no way to weasel-word my way around that.

Suppose that * and 6 (for example) were two different identifiers
for a different units both of which (by default) talk to an interactive
terminal. Since that's not a file, there's no violation of the rule
about two units connecting to the same file. So, closing 6 and
reopening it need not change the connection for *.

Now, *if* redirection (say, on a command) were to associate both
identifiers with the same *file* this logic wouldn't apply. Is that what
happens? If so, I'd agree that they were in violation if the same
association between them were not preserved by CLOSE/OPEN
operations on one of them.

However, suppose that redirection changes the connection for *, but
not for 6 (which would still be connected to the terminal). I don't see
that to be a violation. That means that, by default, they are different
units connected to the same *device* (which isn't a file).

So, if they both *always* stay connected together, I don't see
that as a violation. Or, if they never *change* together, but are
merely both connected to a non-file device by default I don't
see that as a violation.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.



Relevant Pages

  • Re: closing unit=5 and unit=6 and print *
    ... it does not change the connection for * in those ... Suppose that * and 6 were two different identifiers ... there's no violation of the rule ... The Fortran standard has no concept of an interactive terminal. ...
    (comp.lang.fortran)
  • Re: closing unit=5 and unit=6 and print *
    ... it does not change the connection for * in those ... I see no way to weasel-word my way around that. ... Suppose that * and 6 were two different identifiers ... closing 6 and reopening it need not change the connection for *. ...
    (comp.lang.fortran)