11-124r3 To: J3 From: Malcolm Cohen Subject: Interop: On assumed type Date: 2011 February 17 1. Introduction For BIND(C) procedures, an assumed-type array that is neither assumed-shape nor assumed-rank must be passed as a simple void * pointer, i.e. the same as TYPE(C_PTR). This means that the array element size or indeed any other information about its type will not be directly available. Without this information an assumed-shape dope vector, or array pointer dope vector, or C descriptor cannot be constructed. As a consequence, there would be no functional difference between TYPE(*) explicit-shape and TYPE(*) assumed-size. Therefore, to avoid user confusion, TYPE(*) explicit-shape will not be permitted. Also, the TR provides little guidance as to what the contents of the type field of the C descriptor should contain in various cases. Review of these shows that there is little functionality in distinguishing between unknown types that are interoperable, and types that are not interoperable: in both cases, the type is unknown. Therefore this will be simplified to have a single value to indicate an unknown type. 2. Discussion 2.1p2 is problematic, since it implies that CLASS(*) is assumed-type. It is also very strange to read that an assumed-type object "is" something followed by a constraint that it "shall be" something. An edit is provided. Review of 2.1p3 showed that it was much too restrictive, disallowing TYPE(*) entities from appearing in type declaration statements etc.. (Are these meant to be only implicitly typed?) 3. Edits to N1838 [3:10-12] 2.1p2, replace the whole paragraph with "An entity declared with a of TYPE (*) is an assumed-type entity. It has no declared type and its dynamic type and type parameters are assumed from its effective argument." [3:14] C407x1, after "attribute" insert "and is not an explicit-shape array". [3:15] 2.1p3, after "An assumed-type variable shall" replace "appear ... with" with "not appear in a designator or expression except as an actual argument corresponding to". {It is only its appearance in/as a designator/expression that is problematic.} [3:18+] Insert explanatory note "NOTE 2.1 An assumed-type object that is not assumed-shape and not assumed-rank is passed as a simple pointer to the first address of the object. This means that there is insufficient information to construct an assumed-shape dope vector or C descriptor. As a consequence, there would be no functional difference between TYPE(*) explicit-shape and TYPE(*) assumed-size. Therefore TYPE(*) explicit-shape is not permitted." [5:6] "is also required to" -> "shall". {Remove repetitive redundancy, use correct ISO language.} [12:Table 5.2] Delete entry for CFI_type_struct. [13:Table 5.2] Replace entry for CFI_type_unspecified with "CFI_type_other | Any other type". {"None of the above" would also work.} [17:14] 5.2.8p5, at the end before the final full stop, insert "; the type member shall have a value from Table 5.2 that depends on the effective argument as follows: (-) if the dynamic type of the effective argument is an interoperable type listed in Table 5.2, the corresponding value for that type; (-) otherwise, CFI_type_other.". {Bullet list.} ===END===