<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Array of pointers in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797262#M35874</link>
    <description>Steve,&lt;BR /&gt;&lt;BR /&gt;Can you expand on your comment about Fortran pointers? I knew that Fortran pointers aren't the same as C pointers; you can't, for instance, have a Fortran pointer to a function. Your comment about a Fortran pointer being a descriptor with a base address, rank, bounds, and stride information is the first time I can remember seeing that kind of description. Does the CVF documentation contain a more thorough discussion of this?&lt;BR /&gt;&lt;BR /&gt;Can you point me (no pun intended) toward a table that compares and contrasts the characteristics of C and Fortran pointers?&lt;BR /&gt;&lt;BR /&gt;Mike</description>
    <pubDate>Thu, 17 Jul 2003 18:56:48 GMT</pubDate>
    <dc:creator>durisinm</dc:creator>
    <dc:date>2003-07-17T18:56:48Z</dc:date>
    <item>
      <title>Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797256#M35868</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I wish to have an allocatable array of pointers, but&lt;BR /&gt;i seem to have run foul in the declaration.&lt;BR /&gt;&lt;BR /&gt;So.... what do i mean ? &lt;BR /&gt;&lt;BR /&gt;With a simple pointer &lt;BR /&gt;"type (bla_bla), pointer :: po"&lt;BR /&gt;i can access the variables in the type bla_bla with the %&lt;BR /&gt;&lt;BR /&gt;But now i wish to have an array of pointers that i can&lt;BR /&gt;allocate to my wishes. So i was thinking :&lt;BR /&gt;"type (bla_bla), pointer :: po(:)"&lt;BR /&gt;"allocate( po(1:10) )"&lt;BR /&gt;but then the size of po is 10 times the size of the&lt;BR /&gt;bla_bla structure and not 10 times the size of a pointer.&lt;BR /&gt;&lt;BR /&gt;What do i do ? Can i do it at all ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Thomas</description>
      <pubDate>Wed, 16 Jul 2003 20:27:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797256#M35868</guid>
      <dc:creator>thlund</dc:creator>
      <dc:date>2003-07-16T20:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797257#M35869</link>
      <description>Well, you can't do it &lt;B&gt;exactly&lt;/B&gt;, but you can emulate it pretty well:&lt;PRE&gt;type p_BlaBla
   type(bla_bla), pointer:: po =&amp;gt; NULL()
end type p_BlaBla

type(p_blabla), allocatable:: pbb
allocate(pbb(10))
allocate(pbb(4)%po)
pbb(4)%po%foo = 1
&lt;/PRE&gt;Got the idea?&lt;BR /&gt;&lt;BR /&gt;Jugoslav</description>
      <pubDate>Wed, 16 Jul 2003 20:52:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797257#M35869</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2003-07-16T20:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797258#M35870</link>
      <description>In current CVF, po can be ALLOCATABLE too if desired.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Wed, 16 Jul 2003 20:54:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797258#M35870</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2003-07-16T20:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797259#M35871</link>
      <description>Steve,&lt;BR /&gt;Could you please amplify on this a little?&lt;BR /&gt;In C, arrays are vectors of vectors, allowing non-uniform column length. This is particularly useful for upper-right or symmetric matrix storage. It's also nice for building collections of data to be passed through argument lists. &lt;BR /&gt;I didn't think this was possible in Fortran. Jugoslav's construct of a pointer type is very clever and I may use it, but if you can give an example that doesn't require this abstraction, it might be more transparent to others reading my code in later years.&lt;BR /&gt;&lt;BR /&gt;Specifically, can you do something like;&lt;BR /&gt;&lt;BR /&gt;Integer (4), Target  :: a, b&lt;BR /&gt;Integer (4), Pointer :: c(:)&lt;BR /&gt;c(1) =&amp;gt; a &lt;BR /&gt;c(2) =&amp;gt; b&lt;BR /&gt;&lt;BR /&gt;This generates a compiler error, reinforcing my belief that you can declare a pointer to an array, but not an array of pointers.&lt;BR /&gt;&lt;BR /&gt;Any insight you can offer will be appreciated.&lt;BR /&gt;Cliff</description>
      <pubDate>Wed, 16 Jul 2003 21:29:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797259#M35871</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2003-07-16T21:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797260#M35872</link>
      <description>What I said doesn't negate what Jugoslav said - Fortran does not allow you to directly declare an array of pointers.  You have to use a derived type that has a POINTER component, or if it works for you, you can now have an ALLOCATABLE component.  The difference is that an ALLOCATABLE array is always contiguous (a POINTER can refer to a discontiguous section) and assignment of derived types with ALLOCATABLE components automatically does deallocation, reallocation and copying of data as needed.&lt;BR /&gt;&lt;BR /&gt;You can certainly have an array of derived types with ALLOCATABLE array components, each with its own length and allocation status.&lt;BR /&gt;&lt;BR /&gt;Keep in mind that a Fortran pointer, unlike a C pointer, is more than just an address - it is a descriptor with base address, rank, bounds and stride information.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Wed, 16 Jul 2003 23:47:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797260#M35872</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2003-07-16T23:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797261#M35873</link>
      <description>Thanks, but i did think of this. In the program i am&lt;BR /&gt;doing i am getting some very long %%%% expressions,&lt;BR /&gt;so what i was looking for was a way to cut down on&lt;BR /&gt;the lengths.&lt;BR /&gt;&lt;BR /&gt;This certainly is the second best after what i was&lt;BR /&gt;looking for.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Thomas</description>
      <pubDate>Thu, 17 Jul 2003 15:41:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797261#M35873</guid>
      <dc:creator>thlund</dc:creator>
      <dc:date>2003-07-17T15:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797262#M35874</link>
      <description>Steve,&lt;BR /&gt;&lt;BR /&gt;Can you expand on your comment about Fortran pointers? I knew that Fortran pointers aren't the same as C pointers; you can't, for instance, have a Fortran pointer to a function. Your comment about a Fortran pointer being a descriptor with a base address, rank, bounds, and stride information is the first time I can remember seeing that kind of description. Does the CVF documentation contain a more thorough discussion of this?&lt;BR /&gt;&lt;BR /&gt;Can you point me (no pun intended) toward a table that compares and contrasts the characteristics of C and Fortran pointers?&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Thu, 17 Jul 2003 18:56:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797262#M35874</guid>
      <dc:creator>durisinm</dc:creator>
      <dc:date>2003-07-17T18:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797263#M35875</link>
      <description>Mike, look for "Handling Arrays and Visual Fortran Array Descriptors" page in Mixed-Language chapter of Programmer's Guide -- it's rather thorough. &lt;BR /&gt;&lt;BR /&gt;Regarding pointers to functions, I think it's an ommission in F95; I guess that, even if it was raised on J3 Standards Commitee at the time, they didn't have time to work out all necessary details. This is (supposed to be, didn't look at the details yet) fixed in Fortran 2000. (&lt;A href="http://www.j3-fortran.org"&gt;http://www.j3-fortran.org/&lt;/A&gt;)&lt;BR /&gt;&lt;BR /&gt;Jugoslav</description>
      <pubDate>Thu, 17 Jul 2003 20:37:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797263#M35875</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2003-07-17T20:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Array of pointers</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797264#M35876</link>
      <description>Let me clarify.  POINTER to array is a descriptor.  POINTER to a scalar is just an address.  This is the F90 POINTER, not the "Cray POINTER" extension.  This is discussed in various places in the Programmer's Guide, especially in the mixed-language chapter.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Thu, 17 Jul 2003 22:18:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-of-pointers/m-p/797264#M35876</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2003-07-17T22:18:46Z</dc:date>
    </item>
  </channel>
</rss>

