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



To avoid such problems, I use the following ISO_FORTRAN_ENV.f90 file
everywhere with my F95 programs:

module ISO_FORTRAN_ENV

! Nonintrinsic version for Lahey/Fujitsu Fortran for Linux.
! See Subclause 13.8.2 of the Fortran 2003 standard.

implicit NONE
public

integer, parameter :: Character_Storage_Size = 8
integer, parameter :: Error_Unit = 0
integer, parameter :: File_Storage_Size = 8
integer, parameter :: Input_Unit = 5
integer, parameter :: IOSTAT_END = -1
integer, parameter :: IOSTAT_EOR = -2
integer, parameter :: Numeric_Storage_Size = 32
integer, parameter :: Output_Unit = 6

end module ISO_FORTRAN_ENV

I use the same file with Lahey 5.6, CVF and Intel 9.1 (all on Windows),
but I don't use all the values.

And I don't remember who provide it...


Arjen Markus a écrit :

beliav...@xxxxxxx schreef:


It is convenient to have a subroutine that can write to a file or print
to the console, depending on what unit number is passed to it. It is
less convenient to wrap IF statements around all WRITE statements to
choose between unit=* and unit=some_number. If a code assumes that 6 is
the unit for standard output, a PARAMETER should be declared and used
for this, to make this assumption clear.

Yes, but isn't that included in Fortran 2003? (I do not have the
standard
near me, so I can not check, but I remember something like that).
Otherwise, I think it is one of the things Dan Nagle's portability
project
takes care of.

Regards,

Arjen

.



Relevant Pages

  • Re: A few syntax questions
    ... I think putting them in the 'action-stmt' syntax rule ... If I were to redo the bnf from scratch, ... I guess that means that a standard conforming compiler is supposed to overflow. ... I am hoping that F2003 features will regain some respect for Fortran in CS departments,, and not just be coinsidered an old archaic language for old programs, but such strong support of archaic Fortran standards is a major reason why Fortran popularity continues to dwindle. ...
    (comp.lang.fortran)
  • Re: Form k = i + j and test for overflow.
    ... Last night you suggested I was forgetting that overflow violates ... the Fortran standard. ... test that wouldn't work on the most common of implementations. ... that conforms to the Fortran standard. ...
    (comp.lang.fortran)
  • Re: conditional compile for gFortran (GCC?): newbie question
    ... The official standard for a Fortran pre-processor is Part 3, "Conditional Compilation", informally known as CoCo. ... As I mentioned in a message in this thread yesterday, there are free implementations of CoCo available on the Internet. ... Obviously, CPP and its derivatives are widely used for Fortran, but I am not sure that the usage is so universal that it counts as a "de-facto standard", except perhaps in the Unix world. ... the capabilities and behavior of the Fortran pre-processor would be under the control of either the C or C++ committee. ...
    (comp.lang.fortran)
  • Re: FOR070.DAT files appearing
    ... IMPLICIT NONE has been Standard Fortran since 1993 when the Fortran 90 ... When F90 was approved, it became the ... I'd also challenge you to find a commercial Fortran 77 compiler ...
    (comp.os.vms)
  • Re: Any F2003 help translating C++ map syntax?
    ... >>part of the standard language, but makes a mockery of comparing ... > I sometimes miss convenient containers in the standard Fortran. ... That means that the standard STL might not be as ... > a hash table, if I remember correctly. ...
    (comp.lang.fortran)