{"title":"注意创建过程指针数组","authors":"N. Clerman","doi":"10.1145/1520752.1520753","DOIUrl":null,"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.0000,"publicationDate":"2009-03-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":"{\"title\":\"Note on creating an array of procedure pointers\",\"authors\":\"N. Clerman\",\"doi\":\"10.1145/1520752.1520753\",\"DOIUrl\":null,\"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.0000,\"publicationDate\":\"2009-03-27\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"1\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"ACM SIGPLAN Fortran Forum\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/1520752.1520753\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACM SIGPLAN Fortran Forum","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1520752.1520753","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1
摘要
Fortran程序员知道直接形成指针数组是不可能的。对于没有经验的人来说,这个符号可能有些令人困惑。下面一行代码声明了一个内部类型为real的数组。但是下面这行代码是一个指针的声明,它指向一个实值数组,而不是一个指针数组。在下面的代码中,一个指针赋值指向samples数组中的ptr_samples。为了创建指针数组,你可以定义一个数据类型,它的唯一组成部分是指针,然后你可以使用这个新类型的数组作为指针数组。type Real_Ptr_Type real, dimension (:), pointer:: real_ptr_comp end type: Real_Ptr_Type
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