From: Dave Allured on
glen herrmannsfeldt wrote:
>
> Dave Allured <nospom(a)nospom.com> wrote:
> (snip)
>
> > If you really mean just the "print" statement, then this is explicitly
> > prevented by the Fortran 95 standard. 10.8.2, List-directed output,
> > last paragraph:
>
> > Except for continuation of delimited character
> > sequences, each output record begins with a blank
> > character to provide carriage control when the
> > record is printed.
>
> Yes this is the rule for list-directed output, but that has
> nothing to do with PRINT vs. WRITE. WRITE can be used for
> list-directed output, and PRINT can be used with a FORMAT
> statement just fine.
>
> PRINT 1,sqrt(2.0)
> 1 FORMAT(F8.6)
>
> If you want no leading space you have to carefully select
> the w and d, and be careful with negative values.
>
> Strangely, PRINT came in Fortran I, stayed through Fortran II,
> but was not included in the Fortran 66 standard. Many compilers
> supported it for back compatibility, though. It then came
> back, I believe in Fortran 77 but possibly later.
>
> > I expect that the other versions have the same rule. Therefore, do what
> > Ken and Robin said, use a write statement with an explicit format.
>
> Or use PRINT with an explicit FORMAT.

Thanks for the correction, Glen! I am in the habit of using print
*,blah so much that I forgot what the "*" is for! :-)

--Dave
From: glen herrmannsfeldt on
Dave Allured <nospom(a)nospom.com> wrote:
(snip, I wrote)

>> PRINT 1,sqrt(2.0)
>> 1 FORMAT(F8.6)
(snip)

> Thanks for the correction, Glen! I am in the habit of using print
> *,blah so much that I forgot what the "*" is for! :-)

List-directed I/O is so convenient, one wonders why it took
so long to be added to Fortran.

But yes, print *, is somewhat faster to type than write(*,*).

-- glen