J3/99-160r1 Date: 09 June 1999 To: J3 From: Keith Bierman Subject: fixups to 16.2.6 To resolve issues 106, 107 and 109 we propose some modest changes to this section. First we provide the text as we intend it to look, followed by edits intended to accomplish this. Move some text around, so it opens with [page 410 after line 1 add] A formal parameter of a C function corresponds to a dummy argument of a Fortran procedure if they are in the same relative positions in the C parameter list and the dummy argument list, respectively. This should resolve issue 106, the opening text now introduces the topic. In addition an `of' is turned back into the `in' intended in the original. We assume that the 16.2.5 of the unresolved issue was intended to be 16.2.6. Back to the modestly revised text The reference type of a C pointer type is the C type of the objects that the C pointer type points to. A Fortran procedure interoperates with a C function if (1) the procedure is declared with the BIND (C) attribute; (2) the Fortran procedure is a function, the result variable of the procedure and the C function return value interoperate, or if the Fortran procedure is a subroutine, the result type of the C function is compatible with the C type void; (3) the number of dummy arguments of the Fortran procedure is equal to the number of formal parameters of the C function; (4) all the dummy arguments are dummy data objects, none of which have either the POINTER or ALLOCATABLE attributes; (5) any dummy argument with the VALUE attribute interoperates with the corresponding formal parameter of the C function; and (6) any dummy argument without the VALUE attribute corresponds to a formal parameter of the C function that is of a pointer type, and the type of the dummy argument interoperates with the reference type of the formal parameter. The BIND (C) attributes shall not be specified for a procedure that has an asterisk dummy argument. The BIND (C) attribute shall not be specified for a procedure that requires an explicit interface, unless the procedure is defined by a Fortran subprogram. NOTE (to be incorporated into the standard) VALUE cannot be applied to arrays (section 5.1.2.14). It would have been unhelpful to have permitted it, as in C arrays are always passed by reference. END NOTE Also, add text to 5.1.2.14 to make this limitation normative. No other changes at this time (that is text and unresolved issues from 16.13 and beyond as is). Issues 107 and 109 should be closed. EDITS Page 85 line 25 change "The VALUE attribute may be specified only for a dummy argument" to "The VALUE attribute may be specified only for a scalar dummy argument" page 410 after line 1 add A formal parameter of a C function corresponds to a dummy argument of a Fortran procedure if they are in the same relative positions in the C parameter list and the dummy argument list, respectively. page 410 delete lines 5-13 (issue (106) page 410 line 16 delete "if" page 410 line 16 change "results" to "result variable" page 410 delete lines 19-22 (issue 107) page 410 line 31 add " NOTE VALUE cannot be applied to arrays (section 5.1.2.14). It would have been unhelpful to have permitted it, as in C arrays are always passed by reference. END NOTE" page 410 delete lines 32-38 (issue 109)