Recursive I/O on internal files in Fortran 95?
From: Harald Anlauf (anlauf_at_hep.tu-darmstadt.de)
Date: 12/20/04
- Previous message: James Van Buskirk: "Re: Are procedure dummy arguments ignored in generic procedure resolution?"
- Next in thread: James Van Buskirk: "Re: Recursive I/O on internal files in Fortran 95?"
- Reply: James Van Buskirk: "Re: Recursive I/O on internal files in Fortran 95?"
- Reply: James Giles: "e: Recursive I/O on internal files in Fortran 95?"
- Reply: Richard E Maine: "Re: Recursive I/O on internal files in Fortran 95?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Dec 2004 12:03:54 +0100
Hi,
what is the status of recursive I/O on internal files in Fortran 95?
I have a book on my desk that is rather unclear on that point and can
be read as allowing it in that particular case.
I checked the F2k3 draft, where in section 9.11 it appears that it is
allowed (now?), although I have a hard time understanding the following
excerpt:
"A recursive input/output statement shall not modify the value of any
internal unit except that a recursive WRITE statement may modify the
internal unit identified by that recursive WRITE statement."
I'm not a native speaker, so can somebody please explain it in some
detail?
In particular, I'd like to know whether the following code is legal:
program test_rec_io
implicit none
character (len=4) :: s
write (s, '(a)') foo (1234)
write (*,*) s
contains
pure recursive function foo (i) result (s)
integer, intent(in) :: i
character (len=4) :: s
! Internal I/O, allowed recursive in f2k3
write (s, '(i4.4)') i
end function foo
end program test_rec_io
None of the compilers I tried complained during compilation with options
set to strictest conformance. But only the runtime of Intel's ifort 8.1
actually printed the (my) expected result. All others failed, i.e., the
runtime trapped the recursion or gave funny results.
-- Cheers, -ha
- Previous message: James Van Buskirk: "Re: Are procedure dummy arguments ignored in generic procedure resolution?"
- Next in thread: James Van Buskirk: "Re: Recursive I/O on internal files in Fortran 95?"
- Reply: James Van Buskirk: "Re: Recursive I/O on internal files in Fortran 95?"
- Reply: James Giles: "e: Recursive I/O on internal files in Fortran 95?"
- Reply: Richard E Maine: "Re: Recursive I/O on internal files in Fortran 95?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|