ISO/IEC JTC1/SC22/WG5 N1410 To: WG5 From: WG5/interp Subject: Draft interpretations 13-15 and 23-26 Date: 16 August 2000 WG5 offers the following draft interpretations for consideration by J3. ---------------------------------------------------------------------- NUMBER: 000013 TITLE: Format of zero in list-directed and namelist output KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: 1. The fifth paragraph of Section 10.8.2 of the Fortran 90 standard clearly indicates that in list-directed output zero must be formatted according to exponential format. Most, though not all, of the implementations I tried use fixed format. Even the FCVS test suite assumes fixed format. Should exponential format be used for zero in list-directed output? 2. The same issue raised in question 1 applies to namelist output (see Section 10.9.2.1, paragraph 3). Should exponential format be used for zero in namelist output? ANSWER: These questions are duplicated in interpretation number 000067. See the answer to that query. HISTORY: 97-165 m143 Submitted WG5/N1410 Draft answer ---------------------------------------------------------------------- NUMBER: 000014 TITLE: Format of complex numbers in list-directed and namelist output KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: 3. The seventh paragraph of Section 10.8.2 of the Fortran 90 standard states that complex numbers must be written with no embedded blanks unless the complex constant is broken across two records.. Some of the implementations I tested put a blank after the comma even when the entire constant fit in a single record. Is an implementation permitted to include a blank after the comma in a complex constant produced by list-directed output when the constant fits in a single record? 4. Is a blank permitted after the comma in a complex constant produced by namelist output when the constant fits in a single record? ANSWER: 3. No. Section 10.8.2 [178:2-3] states: "The only embedded blanks permitted within a complex constant are between the comma and the end of a record and one blank at the beginning of the next record." 4. No. Section 10.9.2.1 [182:40-41] states: "The only embedded blanks permitted within a complex constant are between the comma and the end of a record and one blank at the beginning of the next record." SUBMITTED BY: HISTORY: 97-165 m143 Submitted WG5/N1410 Draft answer ---------------------------------------------------------------------- NUMBER: 000015 TITLE: Commas in list-directed output KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: 5. The first paragraph of Section 10.8.2 of the Fortran 90 standard states With the exception of adjacent nondelimited character constants, the values are separated by one or more blanks or by a comma optionally preceded by one or more blanks and optionally followed by one or more blanks. I have yet to find a Fortran implementation, other than my own, that satisfies this requirement. In particular, the statement PRINT *, 1, ',' 2 prints a comma immediately following the 1 on every implementation I tried. The comma was followed by zero, one, or two blanks in different implementations. Is a separator required between a constant other than a nondelimited character constant and a following nondelimited character constant in list-directed output? Is a separator required between a nondelimited character constant and a following constant that is not a nondelimited character constant? DISCUSSION: It is not clear in the question if the comma which is output is the optional separator or is the character constant from the list. ANSWER: A separator is required in both cases. The text quoted, which is at page 177:31-33, is quite explicit. The key word is "adjacent". SUBMITTED BY: HISTORY: 97-165 m143 Submitted WG5/N1410 Draft answer ---------------------------------------------------------------------- NUMBER: 000023 TITLE: Termination of the previous record by a WRITE statement KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Suppose a sequential formatted file is positioned within a record as a result of a nonadvancing READ. 1. If the next operation performed on the file is a WRITE, can the current record be terminated at its current position before the next record is written? Section 9.2.1.3.2 appears to preclude the record from being terminated, but at least one Fortran 90 implementation does the record in such an instance. 2. If next operation is a nonadvancing WRITE and the number of characters written does not extend to the end of the current record, are the remaining characters at the end of the record preserved? ANSWER: 1. No. If the current record were to be terminated, the file position would be changed. Section 9.2.1.3.2 [136:37-39] states: "For sequential access on input, if there is a current record, the file position is not changed. Otherwise, the file is positioned at the beginning of the next record and this record becomes the current record." 2. No, the remaining characters in the record are not preserved. The characters are inaccessible. An edit to section 9.2.1.3.2 to clarify the situation is given below. EDIT: [136:44] Change "record becomes" to "record, excluding any data beyond the current point, becomes" SUBMITTED BY: Robert Corbett HISTORY: 98-155 m145 Submitted (part 1) WG5/N1410 Draft answer ---------------------------------------------------------------------- NUMBER: 000024 TITLE: Termination of a partial record by a CLOSE, BACKSPACE, ENDFILE, or REWIND statement KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Suppose a partial record has been written as a result of a nonadvancing WRITE. If the file is closed, or a BACKSPACE, ENDFILE, or REWIND statement is performed on the file, must the partial record be terminated? ANSWER: After a nonadvancing WRITE there is always a current record in a file. Existing descriptions of file closure and of the BACKSPACE, ENDFILE and REWIND statements define subsequent operations on the file. The standard does not have the concept of 'terminating' a partial record - the external representation of any file written by Fortran is processor dependent, including the means of determining record boundaries. However, a 'partial' record that has been written by a Fortran program ought to be readable by a Fortran program. Therefore, on a processor that uses line-feed characters to terminate records, either (i) the processor should emit a terminating line-feed in the situation described, or (ii) the processor should contain the capability to read an 'unterminated' partial record at the end of the file. EDIT: SUBMITTED BY: Robert Corbett HISTORY: 98-155 m145 Submitted (part 2) WG5/N1410 Draft answer ---------------------------------------------------------------------- NUMBER: 000025 TITLE: List-directed input: types of variables corresponding to repeated values KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: When a repeat count is used in list-directed input, must all the variables into which the repeated value is read have the same type? I see no reason in the standard to assume that restriction, but at least one Fortran 90 implementation assumes it ANSWER: DISCUSSION: Section 10.8 [175:7-9] states: "The r*c form is equivalent to r successive appearances of the constant c, and the r* form is equivalent to r successive appearances of the null value." WG5/interp was unable to agree on whether r*c implied r copies of the characters in c or r copies of the constant implied by c, possibly after the association of the first copy in the input record with its associated list item. Both interpretations are possible from the text. The answer to the question is accordingly no or yes. SUBMITTED BY: Robert Corbett HISTORY: 98-155 m145 Submitted (part 3) WG5/N1410 Draft answer ---------------------------------------------------------------------- NUMBER: 000026 TITLE: List-directed input: types of variables corresponding to repeated values KEYWORDS: DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Consider the example CHARACTER*80 STRING COMPLEX Z READ (*, *) Z, STRING Support the input consists of 2*(1.0, 0.0) After the READ, should Z contain (1.0,0.0) and should STRING contain '(1.0,'? ANSWER: (If the first interpretation of r*c in 000025 is correct) No. Z should contain (1.0,0.0) but STRING should contain '(1.0'. The form of the value separator generated by the r*c form is not defined, but any blanks which might notionally be inserted in the input record would be part of the separator and could not be part of the nonlimited character constant read into STRING (Note 10.28). Hence the first character in string is '('. Section 10.8.1 [176:19-20] states: "If the delimiters are omitted, the character sequence is terminated by the first blank, comma, slash, or end of record". Hence the last character in STRING is '0'. (If the second interpretation of r*c in 000025 is correct) No. This is a non- standard conforming statement. SUBMITTED BY: Robert Corbett HISTORY: 98-155 m145 Submitted (part 4) WG5/N1410 Draft answer