gfortran.dg/pr16597.f90 leaves behind a file (bug?)
Richard E Maine
Richard.Maine@nasa.gov
Wed Mar 22 23:21:00 GMT 2006
On Mar 22, 2006, at 3:06 PM, Bud Davis wrote:
> we first open a file with no name, thus it is 'fort.7'
> then we close it.
> then open it again, with status = scratch.
>
> since it existed before the status = scratch open,
> should it be deleted ?
>
> my vote, and it is tentative, is that the file should
> be destroyed because it is opened status = scratch.
Opening a file "again" with status="scratch" is a contradiction. It
is not allowed to specify a filename with status="scratch" and thus
it is not possible to specify that it is the "same" file. Just
because you used the same unit number doesn't make it the same file.
Ideally, something opened with status="scratch" should not ever
previously exist. Something like the C mkstemp should be used to give
it a unique filename that won't conflict with anything else.
Of course, the standard doesn't get that specific about
implementation requirements; it doesn't even define the concept of a
name for a scratch file. But that's a plausible implementation. Just
using fort.nn for scratch files asks for problems like this. Fort.nn
is fine for a default name for implicitly opened files, but it
doesn't seem so fine for scratch ones.
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
More information about the Fortran
mailing list