From: robin on
glen herrmannsfeldt wrote in message ...
>Den7 <rrr7rrr(a)gmail.com> wrote:
>> Please look at this code, why this code is forbidden (in my compiler
>> at least) ?
>
>> integer foo
>> external foo
>> open(11,file='11.out')
>> open(12,file='12.out')
>> write(11,*) foo(12)
>> end
>
>> integer function foo(i)
>> write(12,*) i
>> 1000 foo=i
>> end function foo
>
>> Even if i write into character variable (so called internal write or
>> something like that) i have the same problem.
>> Even more, if i make
>
>> write(12,*,err=1000) i
>
>> i still have the crash. How about your compiler?
>
>The usual implementation has a subroutine call to start,
>specifying the unit, format, and other options, then one call per
>element in the I/O list, and finally one to finish the I/O operation.
>
>If you do I/O in a function then things get mixed up. This restriction
>came when machines had much smaller main memory than they do today.


That may be so, but it isn't the reason.