<?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: pointers to arrays in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Re-pointers-to-arrays/m-p/965621#M22749</link>
    <description>AFAIK no, at least not in the sense you'd like. This is an inherent limitation -- pointers are expressed via array descriptors, which are hidden structures of several bytes, containing starting address, offset and step for each dimension (see documentation for exact Compaq format). For the way you'd like to use pointers, the required information simply cannot fit into that structure. &lt;BR /&gt; &lt;BR /&gt;You might workaround it using your own function. Didn't try the following code but that should be along these lines: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+0"&gt; 
SUBROUTINE ASSOCIATE (ptrArray, IndexArray, targetArray) 
 
REAL, POINTER:: ptrArray(:) 
INTEGER::           IndexArray(:) 
REAL, TARGET:: targetArray(:) 
 
IF (ASSOCIATED(ptrArray)) ... 
   !Allocation/deallocation exception handling here 
END IF 
ALLOCATE(ptrArray(SIZE(IndexArray))) 
DO i=1,SIZE(IndexArray) 
    ptrArray(i) = TargetArray(IndexArray(i)) 
END DO 
 
END SUBROUTINE ASSOCIATE 
&lt;/FONT&gt;&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;You have to be &lt;B&gt;very&lt;/B&gt; careful about memory management &amp;amp; leaks. There also should be an equivalent routine for freeing memory. Note that you have to allocate/deallocate memory for yourself and that the technique is not very efficient.  &lt;BR /&gt; &lt;BR /&gt;An (probably more efficient) alternative, of course, would be to stick to DO-loops &lt;BR /&gt;without making a copy as above. &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
    <pubDate>Tue, 04 Sep 2001 22:27:51 GMT</pubDate>
    <dc:creator>Jugoslav_Dujic</dc:creator>
    <dc:date>2001-09-04T22:27:51Z</dc:date>
    <item>
      <title>Re: pointers to arrays</title>
      <link>https://community.intel.com/t5/Software-Archive/Re-pointers-to-arrays/m-p/965621#M22749</link>
      <description>AFAIK no, at least not in the sense you'd like. This is an inherent limitation -- pointers are expressed via array descriptors, which are hidden structures of several bytes, containing starting address, offset and step for each dimension (see documentation for exact Compaq format). For the way you'd like to use pointers, the required information simply cannot fit into that structure. &lt;BR /&gt; &lt;BR /&gt;You might workaround it using your own function. Didn't try the following code but that should be along these lines: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+0"&gt; 
SUBROUTINE ASSOCIATE (ptrArray, IndexArray, targetArray) 
 
REAL, POINTER:: ptrArray(:) 
INTEGER::           IndexArray(:) 
REAL, TARGET:: targetArray(:) 
 
IF (ASSOCIATED(ptrArray)) ... 
   !Allocation/deallocation exception handling here 
END IF 
ALLOCATE(ptrArray(SIZE(IndexArray))) 
DO i=1,SIZE(IndexArray) 
    ptrArray(i) = TargetArray(IndexArray(i)) 
END DO 
 
END SUBROUTINE ASSOCIATE 
&lt;/FONT&gt;&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;You have to be &lt;B&gt;very&lt;/B&gt; careful about memory management &amp;amp; leaks. There also should be an equivalent routine for freeing memory. Note that you have to allocate/deallocate memory for yourself and that the technique is not very efficient.  &lt;BR /&gt; &lt;BR /&gt;An (probably more efficient) alternative, of course, would be to stick to DO-loops &lt;BR /&gt;without making a copy as above. &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
      <pubDate>Tue, 04 Sep 2001 22:27:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Re-pointers-to-arrays/m-p/965621#M22749</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-09-04T22:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: pointers to arrays</title>
      <link>https://community.intel.com/t5/Software-Archive/Re-pointers-to-arrays/m-p/965622#M22750</link>
      <description>Sorry, rereading my own post I see I wasn't very clear. &lt;BR /&gt; &lt;BR /&gt;Problem with the approach above is that ptrArray is a POINTER only by sintax, not by essence -- if, say, TargetArray changes, ptrArray &lt;B&gt;won't&lt;/B&gt; change, since it points to a copy, not to 'real' TargetArray. What I meant under DO-loops is to simply avoid referencing TargetArray via ptrArray and use double-indexing instead at every occurence, i.e. &lt;CODE&gt;TargetArray(IndexArray(i))&lt;/CODE&gt;. Note that &lt;CODE&gt;TargetArray(IndexArray)&lt;/CODE&gt; (array-valued) construct is also allowed.</description>
      <pubDate>Wed, 05 Sep 2001 17:59:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Re-pointers-to-arrays/m-p/965622#M22750</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-09-05T17:59:07Z</dc:date>
    </item>
  </channel>
</rss>

