Re: Need interpretation



Ron Shepard <ron-shepard@xxxxxxxxxxxxxxxxxx> wrote:

[code elided]

> read(10,cmft,iostat=ierr) i ! this should generate an eof error

Please note that eof is *NOT* an error.

> I think "2" should be the output on the last line, but some
> compilers don't handle the implicit endfile correctly and they print
> out "1" instead. My version of gfortran happens to print out "0",
> which is just an outright error I think.
>
> Is it correct that the standard does define what the above program
> should write in that last write statement?

Yes. And yes, it should be a 2. The first backspace backspaces over the
(possibly virtual) endfile record. The second backspaces over the "2"
record.

I haven't experimented with this in recent years myself, but I've been
told that most compilers get it right these days. I can't vouch for how
accurate that is.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.