BS-ISO-IEC-TR-15581-2001.pdf

上传人:韩长文 文档编号:3746589 上传时间:2019-09-22 格式:PDF 页数:24 大小:166.57KB
返回 下载 相关 举报
BS-ISO-IEC-TR-15581-2001.pdf_第1页
第1页 / 共24页
BS-ISO-IEC-TR-15581-2001.pdf_第2页
第2页 / 共24页
BS-ISO-IEC-TR-15581-2001.pdf_第3页
第3页 / 共24页
BS-ISO-IEC-TR-15581-2001.pdf_第4页
第4页 / 共24页
BS-ISO-IEC-TR-15581-2001.pdf_第5页
第5页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《BS-ISO-IEC-TR-15581-2001.pdf》由会员分享,可在线阅读,更多相关《BS-ISO-IEC-TR-15581-2001.pdf(24页珍藏版)》请在三一文库上搜索。

1、BRITISH STANDARD BS ISO/IEC TR 15581:2001 Information technology Programming languages Fortran Enhanced data type facilities ICS 35.060 NO COPYING WITHOUT BSI PERMISSION EXCEPT AS PERMITTED BY COPYRIGHT LAW Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled

2、Copy, (c) BSI BS ISO/IEC TR 15581:2001 This British Standard, having been prepared under the direction of the DISC Board, was published under the authority of the Standards Committee and comes into effect on 15 September 2001 BSI 07-2001 ISBN 0 580 38254 0 National foreword This British Standard rep

3、roduces verbatim ISO/IEC TR 15581:2001 and implements it as the UK national standard. It supersedes BS ISO/IEC TR 15581:1998 which is withdrawn. The UK participation in its preparation was entrusted to Technical Committee IST/5, Programming languages, Environments and system Software Interfaces, whi

4、ch has the responsibility to: A list of organizations represented on this committee can be obtained on request to its secretary. Cross-references The British Standards which implement international or European publications referred to in this document may be found in the BSI Standards Catalogue unde

5、r the section entitled “International Standards Correspondence Index”, or by using the “Find” facility of the BSI Standards Electronic Catalogue. A British Standard does not purport to include all the necessary provisions of a contract. Users of British Standards are responsible for their correct ap

6、plication. Compliance with a British Standard does not of itself confer immunity from legal obligations. aid enquirers to understand the text; present to the responsible international/European committee any enquiries on the interpretation, or proposals for change, and keep the UK interests informed;

7、 monitor related international and European developments and promulgate them in the UK. Summary of pages This document comprises a front cover, an inside front cover, the ISO/IEC TR front cover, pages i to v, a blank page, pages 1 to 14, an inside back cover and a back cover The BSI copyright date d

8、isplayed in this document indicates when the document was last issued. Amendments issued since publication Amd. No. DateComments Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI Reference number ISO/IEC TR 15581:2001(E) TECHNICAL REPORT ISO/I

9、EC TR 15581 Second edition 2001-06-01 Information technology Programming languages Fortran Enhanced data type facilities Technologies de linformation Langages de programmation Fortran Facilits de type de donnes amliores Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006,

10、Uncontrolled Copy, (c) BSI ii Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI ISO/IEC TR 15581:2001(E) iii Contents 1 GENERAL1 1.1 Scope1 1.2 Normative Reference1 2 REQUIREMENTS2 2.1 Allocatable Attribute Regularization2 2.2 Allocatable Arra

11、ys as Dummy Arguments3 2.3 Allocatable Array Function Results4 2.4 Allocatable Array Components4 3 REQUIRED EDITORIAL CHANGES TO ISO/IEC 1539-1 : 19977 ANNEX A14 Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI ISO/IEC TR 15581:2001(E) iv For

12、eword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical

13、 committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non- governmental, in liaison with ISO and IEC, also take part i

14、n the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. The main task of technical committees is to prepare International Standards, but in exceptional circumstances a technical committee may propose the publication of a Technical

15、Report of one of the following types: type 1, when the required support cannot be obtained for the publication of an International Standard, despite repeated efforts; type 2, when the subject is still under technical development or where for any other reason there is still the future but not immedia

16、te possibility of an agreement on an International Standard; type 3, when a technical committee has collected data of a different kind from that which is normally published as an International Standard (“state of the art”, for example). Technical Reports of types 1 and 2 are subject to review within

17、 three years of publication, to decide whether they can be transformed into International Standards. Technical Reports of type 3 do not necessarily have to be reviewed until the data they provide are considered to be no longer valid or useful. Technical Reports are drafted in accordance with the rul

18、es given in the ISO/IEC Directives, Part 3. Attention is drawn to the possibility that some of the elements of this Technical Report may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights. ISO/IEC TR 15581, which is a Technical Re

19、port of type 2, was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments and system software interfaces. This second edition cancels and replaces the first edition (ISO/IEC TR 15581:1998), which has been technicall

20、y revised. Annex A of this Technical Report is for information only. This Technical Report specifies an extension to the data type facilities of the programming language Fortran. Fortran is specified by the international standard ISO/IEC 1539-1. This document has been prepared by ISO/IEC JTC1/SC22/W

21、G5, the technical working group for the Fortran language. It is the intention of ISO/IEC JTC1/SC22/WG5 that the semantics and syntax specified by this Technical Report be included in the next revision of the Fortran standard (ISO/IEC 1539-1) without change unless experience in the implementation and

22、 use of this feature identifies any errors that need to be corrected, or changes are required to achieve proper integration, in which case every reasonable effort will be made to minimize the impact of such changes on existing commercial implementations. Licensed Copy: sheffieldun sheffieldun, na, T

23、hu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI ISO/IEC TR 15581:2001(E) v Introduction There are many situations when programming in Fortran where it is necessary to allocate and deallocate arrays of variable size but the full power of pointer arrays is unnecessary and undesirable. In

24、 such situations the abilities of a pointer array to alias other arrays and to have non-unit (and variable at execution time) strides are unnecessary, and they are undesirable because this limits optimization, increases the complexity of the program, and increases the likelihood of memory leakage. T

25、he ALLOCATABLE attribute solves this problem but can currently only be used for locally stored arrays, a very significant limitation. The most pressing need is for this to be extended to array components; without allocatable array components it is overwhelmingly difficult to create opaque data types

26、 with a size that varies at runtime without serious performance penalties and memory leaks. A major reason for extending the ALLOCATABLE attribute to include dummy arguments and function results is to avoid introducing further irregularities into the language. Furthermore, allocatable dummy argument

27、s improve the ability to hide inessential details during problem decomposition by allowing the allocation and deallocation to occur in called subprograms, which is often the most natural position. Allocatable function results ease the task of creating array functions whose shape is not determined in

28、itially on function entry, without negatively impacting performance. This extension is being defined by means of a Technical Report in the first instance to allow early publication of the proposed definition. This is to encourage early implementation of important extended functionalities in a consis

29、tent manner and will allow extensive testing of the design of the extended functionality prior to its incorporation into the language by way of the revision of ISO/IEC 1539-1. Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI Licensed Copy: sh

30、effieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI TECHNICAL REPORTISO/IEC TR 15581:2001(E) 1 Information technology - Programming languages - Fortran - Enhanced data type facilities 1 General 1.1 Scope This Technical Report specifies an extension to the data-t

31、ype facilities of the programming language Fortran. The current Fortran language is specified by ISO/IEC 1539-1 : 1997. The proposed extension allows dummy arguments, function results, and components of derived types to be allocatable arrays. Clause 2 of this Technical Report contains a general info

32、rmal but precise description of the proposed extended functionalities. Clause 3 contains detailed editorial changes which if applied to the current International Standard would implement the revised language specification. 1.2 Normative Reference The following normative document contains provisions

33、which, through reference in this text, constitute provisions of this Technical Report. For dated references, subsequent amendments to, or revisions of, any of these publications do not apply. However, parties to agreements based on this Technical Report are encouraged to investigate the possibility

34、of applying the most recent edition of the normative document indicated below. For undated references, the latest edition of the normative document referred to applies. Members of ISO and IEC maintain registers of currently valid International Standards. ISO/IEC 1539-1 : 1997 Information technology

35、- Programming languages - Fortran - Part 1: Base language. Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI ISO/IEC TR 15581:2001(E) 2 2 Requirements The following subclauses contain a general description of the extensions required to the syn

36、tax and semantics of the current Fortran language to provide facilities for regularization of the ALLOCATABLE attribute. 2.1 Allocatable Attribute Regularization In order to avoid irregularities in the language, the ALLOCATABLE attribute needs to be allowed for all data entities for which it makes s

37、ense. Thus, this attribute which was previously limited to locally stored array variables is now allowed on array components of structures, dummy arrays, and array function results. Allocatable entities remain forbidden from occurring in all places where they may be storage-associated (COMMON blocks

38、 and EQUIVALENCE statements). Allocatable array components may appear in SEQUENCE types, but objects of such types are then prohibited from COMMON and EQUIVALENCE. The semantics for the allocation status of an allocatable entity remain unchanged: If it is in a main program or has the SAVE attribute,

39、 it has an initial allocation status of not currently allocated. Its allocation status changes only as a result of ALLOCATE and DEALLOCATE statements. If it is a module variable without the SAVE attribute, the initial allocation status is not currently allocated and the allocation status may become

40、not currently allocated (by automatic deallocation) whenever execution of a RETURN or END statement results in no active procedure having access to the module. If it is a local variable (not accessed by use or host association) and does not have the SAVE attribute, the allocation status becomes not

41、currently allocated on entry to the procedure. On exit from this procedure, if it is currently allocated it is automatically deallocated and the allocation status changes to not currently allocated. Since an allocatable entity cannot be an alias for an array section (unlike pointer arrays), it may a

42、lways be stored contiguously. Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI ISO/IEC TR 15581:2001(E) 3 2.2 Allocatable Arrays as Dummy Arguments An allocatable dummy argument array shall have associated with it an actual argument which is

43、also an allocatable array. On procedure entry the allocation status of an allocatable dummy array becomes that of the associated actual argument. If the dummy argument is INTENT(OUT) and the associated actual argument is currently allocated, the actual argument is deallocated on procedure invocation

44、 so that the dummy argument has an allocation status of not currently allocated. If the dummy argument is not INTENT(OUT) and the actual argument is currently allocated, the value of the dummy argument is that of the associated actual argument. While the procedure is active, an allocatable dummy arg

45、ument array that does not have INTENT(IN) may be allocated, deallocated, defined, or become undefined. If any of these events occur no reference to the associated actual argument via another alias is permitted . On exit from the routine the actual argument has the allocation status of the allocatabl

46、e dummy argument (there is no change, of course, if the allocatable dummy argument has INTENT(IN). The usual rules apply for propagation of the value from the dummy argument to the actual argument. No automatic deallocation of the allocatable dummy argument occurs as a result of execution of a RETUR

47、N or END statement in the procedure of which it is a dummy argument. Note that an INTENT(IN) allocatable dummy argument array cannot have its allocation status altered within the called procedure. Thus the main difference between such a dummy argument and a normal dummy array is that it might be una

48、llocated on entry (and throughout execution of the procedure). Example SUBROUTINE LOAD(ARRAY, FILE) REAL, ALLOCATABLE, INTENT(OUT) : ARRAY(:, :, :) CHARACTER(LEN=*), INTENT(IN) : FILE INTEGER UNIT, N1, N2, N3 INTEGER, EXTERNAL : GET_LUN UNIT = GET_LUN()! Returns an unused unit number OPEN(UNIT, FILE

49、=FILE, FORM=UNFORMATTED) READ(UNIT) N1, N2, N3 ALLOCATE(ARRAY(N1, N2, N3) READ(UNIT) ARRAY CLOSE(UNIT) END SUBROUTINE LOAD Licensed Copy: sheffieldun sheffieldun, na, Thu Nov 23 03:54:26 GMT+00:00 2006, Uncontrolled Copy, (c) BSI ISO/IEC TR 15581:2001(E) 4 2.3 Allocatable Array Function Results An allocatable array function shall have an explicit interface. On entry to an allocatable array function, the allocation status of the result variable becomes not currently allocated. The function result variable may be allocated and deallocate

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1