J3/00-292 To: J3 From: Malcolm Cohen Subject: Interpretation Request (F2002 unresolved issue 267) Date: 17th September 2000 NUMBER: 000086 TITLE: Definition status requirements for defined operations KEYWORDS: Defined operations DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: 7.1.7 "Evaluation of operations" states "This section applies to both intrinsic and defined operations. Any variable ... used as an operand in an expression shall be defined at the time the reference is executed." (1) Was this particular requirement intended to apply to defined operations? I.e., is the following example program invalid: MODULE m INTERFACE OPERATOR (.cand.) MODULE PROCEDURE default_cand END INTERFACE CONTAINS LOGICAL FUNCTION default_cand(a,b) RESULT(r) LOGICAL,INTENT(IN) :: a,b IF (a) THEN r = b ELSE r = .FALSE. END IF END FUNCTION END PROGRAM example1 USE m LOGICAL :: false = .FALSE. LOGICAL :: undefined PRINT *, false .cand. undefined END (2) If the answer to the question is Yes (and the program is therefore invalid), would the program be standard-conforming if the penultimate line were changed to PRINT *, default_cand(false,undefined) ? (3) 7.1.7 goes on to state "When a structure is referenced, all of the components shall be defined." Does this mean that pointer components must be associated with a defined target? I.e. is the following program non-conforming? MODULE m2 TYPE my_iptr PRIVATE INTEGER,POINTER :: ptr => NULL() END TYPE INTERFACE OPERATOR(.isnull.) MODULE PROCEDURE isnull_myip END INTERFACE CONTAINS LOGICAL FUNCTION isnull_myip(x) TYPE(my_iptr),INTENT(IN) :: x isnull_myip = ASSOCIATED(x%ptr) END FUNCTION END PROGRAM example2 TYPE(my_iptr) a PRINT *,.isnull.a END (4) If the program is not standard-conforming, would changing the penultimate line to "PRINT *,isnull_myip(a)" make it standard-conforming. ANSWER: (1) No, the requirement was not intentional. (3) No, this was a mistake. Discussion: Usage of defined operations is intended to be equivalent to ordinary function references. All of the examples given above are standard-conforming. EDITS: [97:1] Replace "in an expression" with "of an intrinsic operation". {Only require operands to be defined for intrinsic operations.} [97:5] Replace "all of its components" with "it". {A structure may be referenced whenever it is defined.} HISTORY: 154-mjc-007 m154 Submitted ----------------------------------------------------------------------