This paper outlines a reference counting programming pattern for derived types in Fortran 95/2003. Modern object oriented languages like Java [1, 3] and Python [2, 6] use reference counting to free the programmer from the concern of object allocation and deallocation, thus making possible memory leaks almost obsolete. The reference counting pattern outlined here is being used with the PyF95++ pre-processor [5] and the accompanying Standard Template Library. All the containers in that project are reference counted containers and employ this pattern. The result of this pattern is something akin to an auto ptr template class in C++ [4].
{"title":"A reference counting implementation in Fortran 95/2003","authors":"David Car","doi":"10.1145/1753166.1753168","DOIUrl":"https://doi.org/10.1145/1753166.1753168","url":null,"abstract":"This paper outlines a reference counting programming pattern for derived types in Fortran 95/2003. Modern object oriented languages like Java [1, 3] and Python [2, 6] use reference counting to free the programmer from the concern of object allocation and deallocation, thus making possible memory leaks almost obsolete. The reference counting pattern outlined here is being used with the PyF95++ pre-processor [5] and the accompanying Standard Template Library. All the containers in that project are reference counted containers and employ this pattern. The result of this pattern is something akin to an auto ptr template class in C++ [4].","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"37 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2010-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126890044","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
This article outlines a framework that was used to create a templating capability in the Fortran 95/2003 language (hereafter simply referenced as Fortran) as well as additional useful features which provide a native feel for integration into the language. Recent comparisons of Fortran with C++ have cited the lack of templating in Fortran as a major deficiency in the language [1]. Templating is a very powerful capability which allows the programmer to easily create and maintain more complex code than would be desirable to do manually. There are some very good C++ resources on templating for those not familiar with the subject [4] and are worth reading to gain a more thorough appreciation for the concept than what will be discussed here.
{"title":"PyF95++: a templating capability for the Fortran 95/2003 language","authors":"David Car, Michael List","doi":"10.1145/1753166.1753167","DOIUrl":"https://doi.org/10.1145/1753166.1753167","url":null,"abstract":"This article outlines a framework that was used to create a templating capability in the Fortran 95/2003 language (hereafter simply referenced as Fortran) as well as additional useful features which provide a native feel for integration into the language. Recent comparisons of Fortran with C++ have cited the lack of templating in Fortran as a major deficiency in the language [1]. Templating is a very powerful capability which allows the programmer to easily create and maintain more complex code than would be desirable to do manually. There are some very good C++ resources on templating for those not familiar with the subject [4] and are worth reading to gain a more thorough appreciation for the concept than what will be discussed here.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"129 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2010-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126272059","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Programmers have long practiced the matter of mixed language procedure calls. This is particularly true for the programming languages C and Fortran. The use of the alternate language often results in efficient running time or the effective use of human or other resources. Prior to the Fortran 2003 standard there was silence about how the two languages interoperated. Before this release there existed a set of differing ad hoc methods for making the inter-language calls. These typically depended on the Fortran and C compilers. The newer Fortran standard provides an intrinsic module, iso_c_binding, that permits the languages to interoperate. There remain restrictions regarding interoperable data types. This paper illustrates several programs that contain core exercises likely to be encountered by programmers. The source code is available from the first author's web site. Included is an illustration of a "trap" based on use of the ad hoc methods: A call from a C to a Fortran 2003 routine that passes a character in C to a character variable in Fortran results in a run-time error.
{"title":"Standardized mixed language programming for Fortran and C","authors":"B. Einarsson, R. Hanson, T. Hopkins","doi":"10.1145/1667140.1667142","DOIUrl":"https://doi.org/10.1145/1667140.1667142","url":null,"abstract":"Programmers have long practiced the matter of mixed language procedure calls. This is particularly true for the programming languages C and Fortran. The use of the alternate language often results in efficient running time or the effective use of human or other resources.\u0000 Prior to the Fortran 2003 standard there was silence about how the two languages interoperated. Before this release there existed a set of differing ad hoc methods for making the inter-language calls. These typically depended on the Fortran and C compilers. The newer Fortran standard provides an intrinsic module, iso_c_binding, that permits the languages to interoperate. There remain restrictions regarding interoperable data types.\u0000 This paper illustrates several programs that contain core exercises likely to be encountered by programmers. The source code is available from the first author's web site. Included is an illustration of a \"trap\" based on use of the ad hoc methods: A call from a C to a Fortran 2003 routine that passes a character in C to a character variable in Fortran results in a run-time error.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"17 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-12-04","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126572401","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
While most of the minor items on the Fortran 2008 work list were completed (only the INTENT( SCRATCH) item was dropped), there were two major items that were dropped. These were the Generic Programming item (that had morphed into the Intelligent Macros item) and the new intrinsic BITS type. This was a substantial reduction of the scope of the work for Fortran 2008. Later, additionally, large parts of the coarrays item were removed to a TR. This was a second substantial reduction of the scope of the work for Fortran 2008. No one has said how delaying Fortran 2008 will make Fortran 2003 any easier to implement, or change the compiler vendors' estimates of their customers' priorities. Nor is there any indication that Fortran 2008 needs any general experience with Fortran 2003, since it is almost entirely a revision of Fortran 95 plus the TRs published between Fortran 95 and Fortran 2003; the TRs are now widely implemented.
{"title":"Joint J3/WG5 meetings November 2008, May 2009: a reply to David Muxworthy","authors":"D. Nagle","doi":"10.1145/1667140.1667143","DOIUrl":"https://doi.org/10.1145/1667140.1667143","url":null,"abstract":"While most of the minor items on the Fortran 2008 work list were completed (only the INTENT( SCRATCH) item was dropped), there were two major items that were dropped. These were the Generic Programming item (that had morphed into the Intelligent Macros item) and the new intrinsic BITS type. This was a substantial reduction of the scope of the work for Fortran 2008. Later, additionally, large parts of the coarrays item were removed to a TR. This was a second substantial reduction of the scope of the work for Fortran 2008. No one has said how delaying Fortran 2008 will make Fortran 2003 any easier to implement, or change the compiler vendors' estimates of their customers' priorities. Nor is there any indication that Fortran 2008 needs any general experience with Fortran 2003, since it is almost entirely a revision of Fortran 95 plus the TRs published between Fortran 95 and Fortran 2003; the TRs are now widely implemented.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"86 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-12-04","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126774089","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
This paper develops a standard conforming generic linked list in Fortran 95 which is capable of storing data of any type. The list is implemented using the transfer intrinsic function, and although the interface is generic, it remains relatively simple and minimizes the potential for error. Although linked lists are the focus of this paper, the generic programming techniques used are very general and broadly-applicable to other data structures and procedures implemented in Fortran 95 that need to be used with data of an unknown type.
{"title":"A generic linked list implementation in Fortran 95","authors":"Jason R. Blevins","doi":"10.1145/1667140.1667141","DOIUrl":"https://doi.org/10.1145/1667140.1667141","url":null,"abstract":"This paper develops a standard conforming generic linked list in Fortran 95 which is capable of storing data of any type. The list is implemented using the transfer intrinsic function, and although the interface is generic, it remains relatively simple and minimizes the potential for error. Although linked lists are the focus of this paper, the generic programming techniques used are very general and broadly-applicable to other data structures and procedures implemented in Fortran 95 that need to be used with data of an unknown type.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"26 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-12-04","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131755266","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
The SC22 ballot on the Committee Draft of the revision of Fortran 2003 took place during the summer of 2008. This was the first opportunity for the member body organizations of ISO, as distinct from the individuals working in WG5, to express an opinion on the proposals so far. Fifteen countries voted and three member countries failed to vote. The counts were: Approval: 8 (only one of which had played an active part in WG5) Approval with comments: 3 (all active in WG5) Abstention: 3 (one active in WG5) Disapproval: 1 (UK)
{"title":"WG5 meetings: November 2008 and May 2009: a personal view","authors":"D. Muxworthy","doi":"10.1145/1570522.1570523","DOIUrl":"https://doi.org/10.1145/1570522.1570523","url":null,"abstract":"The SC22 ballot on the Committee Draft of the revision of Fortran 2003 took place during the summer of 2008. This was the first opportunity for the member body organizations of ISO, as distinct from the individuals working in WG5, to express an opinion on the proposals so far. Fifteen countries voted and three member countries failed to vote. The counts were: Approval: 8 (only one of which had played an active part in WG5) Approval with comments: 3 (all active in WG5) Abstention: 3 (one active in WG5) Disapproval: 1 (UK)","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"2 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-07-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125117467","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Introduction This is a repeating article in Fortran Forum. The first version appeared in Fortran Forum in April 2007. The basis for the entries in the list of features was a report by John Reid. An electronic version can be found at: ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1648.pdf If you are a compiler vendor and would like to be included in future versions of this table please email one of us with details and they will be added to the table and published in Fortran Forum.
{"title":"Compiler support for the Fortran 2003 and 2008 standards","authors":"I. Chivers, J. Sleightholme","doi":"10.1145/1570522.1570525","DOIUrl":"https://doi.org/10.1145/1570522.1570525","url":null,"abstract":"Introduction This is a repeating article in Fortran Forum. The first version appeared in Fortran Forum in April 2007. The basis for the entries in the list of features was a report by John Reid. An electronic version can be found at: ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1648.pdf If you are a compiler vendor and would like to be included in future versions of this table please email one of us with details and they will be added to the table and published in Fortran Forum.","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"63 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-07-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124887960","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"An introduction to Sun studio","authors":"I. Chivers, J. Sleightholme","doi":"10.1145/1520752.1520754","DOIUrl":"https://doi.org/10.1145/1520752.1520754","url":null,"abstract":"","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"85 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-03-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"132740698","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Introduction Fortran programmers know that it is not possible to directly form an array of pointers. To the uninitiated, the notation may be somewhat confusing. The following line of code is a declaration of an array of intrinsic type real. real , dimension (20) :: samples But the following line of code is a declaration of a pointer to an array of real values, not an array of pointers. real , dimension (:) , pointer :: ptr_samples And in the following code, a pointer assignment points ptr_samples at the samples array. ptr_samples => samples To create an array of pointers, you can define a data type whose sole component is a pointer, and you can then use an array of this new type as a pointer array. type Real_Ptr_Type real , dimension (:) , pointer :: real_ptr_comp end type Real_Ptr_Type
Fortran程序员知道直接形成指针数组是不可能的。对于没有经验的人来说,这个符号可能有些令人困惑。下面一行代码声明了一个内部类型为real的数组。但是下面这行代码是一个指针的声明,它指向一个实值数组,而不是一个指针数组。在下面的代码中,一个指针赋值指向samples数组中的ptr_samples。为了创建指针数组,你可以定义一个数据类型,它的唯一组成部分是指针,然后你可以使用这个新类型的数组作为指针数组。type Real_Ptr_Type real, dimension (:), pointer:: real_ptr_comp end type: Real_Ptr_Type
{"title":"Note on creating an array of procedure pointers","authors":"N. Clerman","doi":"10.1145/1520752.1520753","DOIUrl":"https://doi.org/10.1145/1520752.1520753","url":null,"abstract":"Introduction Fortran programmers know that it is not possible to directly form an array of pointers. To the uninitiated, the notation may be somewhat confusing. The following line of code is a declaration of an array of intrinsic type real. real , dimension (20) :: samples But the following line of code is a declaration of a pointer to an array of real values, not an array of pointers. real , dimension (:) , pointer :: ptr_samples And in the following code, a pointer assignment points ptr_samples at the samples array. ptr_samples => samples To create an array of pointers, you can define a data type whose sole component is a pointer, and you can then use an array of this new type as a pointer array. type Real_Ptr_Type real , dimension (:) , pointer :: real_ptr_comp end type Real_Ptr_Type","PeriodicalId":379614,"journal":{"name":"ACM SIGPLAN Fortran Forum","volume":"31 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2009-03-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115936819","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}