J3/08-156r2 To: J3 From: Malcolm Cohen Subject: Attributes, especially the EXTERNAL attribute Date: 2008 May 15 Reference: 08-007r2 1. Introduction This paper fixes some sloppiness, inaccuracies, and technical flaws in the description of the EXTERNAL attribute. Some editorial improvements to attributes in general are also contained. 2. Note extra edits The edits below to [94:5.3.9 C538] and [301:12.6.2.1p1] were in 08-156 (r0) in a less wordsmithed form, and were accidentally omitted in 08-156r2. 3. Edits [87:5.3.1p1] Delete whole paragraph. {Opening sentence is very incomplete and thus potentially misleading; all this varies on an attribute-by-attribute basis anyway and thus is specified properly and individually elsewhere. The second sentence is totally content-free, saying nothing that is not said by the title of the subclause and the text of the constraints themselves.} [87:5.3.1 C515] Move C515 into 5.3.8.1 "General" subclause of 5.3.1 DIMENSION attribute. {Seems a more appropriate place.} [94:5.3.9 C538] Delete constraint "In an ... subprogram." {This contraint becomes unnecessary after the change done by the edit below to p301, because once we say that external subprograms have the EXTERNAL attribute in their own definition, it is covered by the general prohibition against duplicate specification in C514.} [94:5.3.9p2] Replace whole paragraph "If an external ... attribute." with "The EXTERNAL attribute for an external or dummy procedure allows it to be an actual argument (12.5.2.9) or the target of a procedure pointer assignment (7.2.2.4). The EXTERNAL attribute for a BLOCK DATA subprogram confirms that it is part of the program." And move Note 12.11 from [282:12.4.3.5 EXTERNAL statement] to follow the replaced paragraph. {Explain the purpose of EXTERNAL. The requirements will reappear in the contexts where they are required.} [104:5.4.8+] Move subclause 12.4.3.5 "EXTERNAL statement" To follow (the end of) subclause 5.4.8 "DIMENSION statement", In the process, deleting p2 "The appearanece ... part of the program."; Note that this is after the moving of its Note 12.11 above. {There is no longer lots of c12-specific junk in this subclause, so it belongs back with all the other attribute specification statements. The contents of p2 get deleted because we've put it into the attribute subclause on p94.} [104:5.4.9+] Move subclause 12.4.3.7 "INTRINSIC statement" To follow (the end of) subclause 5.4.9 "INTENT statement". {There is no longer lots of c12-specific junk in this subclause, so it belongs back with all the other attribute specification statements.} ***NOTE TECHNICAL CHANGE [157:7.2.2.2 C731] Append new sentence to constraint "If is the name of an external or dummy procedure, it shall have the EXTERNAL attribute." {This is where the requirement on procedure pointer assignment belongs (it was previously in 5.3.9p2). Make it a constraint because it obviously fits perfectly with the pre-existing C731.} Comment: Unfortunately we cannot make the parallel requirement for actual arguments into a constraint, because that case cannot always be detected at compile time. [282:12.4.3.5] As described above, this subclause has been disassembled and moved. [285:12.4.3.7] As described above, this subclause has been moved. [294:12.5.2.9p4] Replace paragraph "If an external ... attribute." with "An external procedure or dummy procedure that is used as an actual argument shall have the EXTERNAL attribute." {Simplified wording now possible.} [299:12.5.5.1p3(3)] Before "EXTERNAL" delete "explicit". {Regularise misleading wording to match that in item (2).} ***NOTE TECHNICAL CHANGE [301:12.6.2.1p1] Append to paragraph "Except for a function whose result name is the same as its function name, an external procedure definition explicitly specifies the EXTERNAL attribute for that procedure within the scoping unit of the subprogram that defines it". {Saying that an external procedure has the EXTERNAL attribute in its own definition simplifies several other places where we needed special wording to cover that case, specifically C538 and the places where we said "have an explicit interface or the EXTERNAL attribute". TECHNICAL CHANGE: This regularises the constraints on (being the target of a) procedure pointer assignment so that they are parallel to those on actual/dummy procedure argument passing. This was the intent all along, procedure pointers being modelled on dummy procedures, it's just that we got it very slightly wrong. The technical change is that after this change a procedure is allowed to be the target in a procedure pointer assignment statement in its own definition (subprogram).} ===END===