Print

Print


Hello Bertrand,

On Tue, 30 Nov 2004, Bertrand Meltz wrote:

> I often use this piece of program in my codes.
> Some compilers insist that this is a recursive library call.
> Is it really?
>
> !-----------------------------------
> program test
> print *, the_date()
> contains
>
>    function the_date() result( day)
>
>    implicit none
>    character( LEN=17) :: day
>    character(len=8)  :: date
>    character(len=10) :: time
>
>    call DATE_AND_TIME( date, time)
>    write( day, '(a7,a2,a1,a2,a1,a4)')   &
>          'Date : ', date(7:8), '/', date(5:6), '/', date(1:4)
>    end function the_date
>
> end program test
> !-----------------------------------

This program contains a recursive I/O reference, and this is
not allowed in Fortran 90/95. (The 'print' calls 'the_date',
and this in turn calls 'write'.)  I have the same problems!
Some time ago I heard that Fortran 2003 will release this
restriction in that a nesting of internal I/O with external
I/O should become possible.  This would make our problem go
away.  But I don't know whether will really be implemented
in the coming F 2003 standard.

Roland


+----------------------------------------------------------------------+
|  Roland Schilling                      Home-Office: +49(89)32929-670 |
|  Max-Planck-Institut für Gravitationsphysik                          |
|  -- Albert-Einstein-Institut --                                      |
|  D-85748 Garching                           E-mail:   [log in to unmask] |
|  Germany                           http://www.geo600.uni-hannover.de |
+----------------------------------------------------------------------+