User account creation filtered due to spam.

Bug 30123 - Document INQUIRE, especially UNFORMATTED and FORMATTED
Summary: Document INQUIRE, especially UNFORMATTED and FORMATTED
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2006-12-08 18:17 UTC by Tobias Burnus
Modified: 2014-03-30 18:08 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-09-12 15:42:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2006-12-08 18:17:42 UTC
We currently don't have any documentation for the INQUIRE statement; it should not be put into the Intrinsic Procedures chapter as it is not an intrinsic procedure. Maybe create a "File Operation I/O Statements" chapter?

Inquire should be straight forward (with the problem between Fortran 95 and Fortran 2003; the latter allows at least for all arguments now all kinds rather than only the default kind).

Most important is to document the UNFORMATTED and the FORMATTED specifier.

Their use is to return whether a file is unformatted or formatted, but this is in practice impossible to tell reliably. (This should be made clear in the documentation.) - possible values UNKNOWN, YES, NO. Returning always "UNKNOWN" would be the most correct answer ;-)
Cf. http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/cd8524acdbea6b6e/


Implementation choice of gfortran for both formatted/unformatted:

- UNIT of unconnected file (and only preconnected files?) and file name="": UNKNOWN

- Filename of existing file (and connected files, queried via UNIT):
YES - if it is a file (regular, block/character device, named pipe)
NO - if it is a directory
UNKNOWN - otherwise

Other compilers have often:
- UNKNOWN - for unconnected files
- YES - for UNFORMATTED, if connected as UNFORMATTED
- NO - for FORMATTED if connected as UNFORMATTED
(and the last two vice versa if connected as FORMATTED)

Most people using FORMATTED or UNFORMATTED actually want to use FORM, values:
- UNDEFINED for unconnected files
- FORMATTED for as formatted opened files
- UNFORMATTED for as unformatted opened files
Comment 1 Jerry DeLisle 2006-12-08 23:22:12 UTC
A quick look at the IBM Fortran manual on this states that the (un)formatted= specifier indicates whether or not a file may be connected or not as an (un)formatted file.  The wording appears clearer than the Fortran standards.

Not intending to copy that particular wording, but this does need some word engineering and probably some review by some of our experts.  I think the particular implementation in gfortran is OK.
Comment 2 Jerry DeLisle 2006-12-09 07:25:44 UTC
There is a similar case with STREAM=
Comment 3 Jerry DeLisle 2010-09-12 15:42:44 UTC
Adding to my list