<?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 Final procedure does not work for array elements ? in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759952#M15439</link>
    <description>The selection of the final procedure is based off the rank of the thing being finalized, just like the selection of generic procedures (except final procedures only ever have one argument). &lt;BR /&gt;&lt;BR /&gt;If you wanted your procedure to be called when finalizing any array you could make it elemental. Alternatively provide a final procedure that takes a rank one array.</description>
    <pubDate>Wed, 07 Dec 2011 07:05:10 GMT</pubDate>
    <dc:creator>IanH</dc:creator>
    <dc:date>2011-12-07T07:05:10Z</dc:date>
    <item>
      <title>Final procedure does not work for array elements ?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759951#M15438</link>
      <description>If we allocate an array for a class with destructor(final procedure), the final procedure does not invoked for deallocate. Is there any method to invoke destructor ?&lt;BR /&gt;&lt;BR /&gt;--- Sample Code ----&lt;BR /&gt;module m_test&lt;BR /&gt; private&lt;BR /&gt; public::t_test&lt;BR /&gt; type t_test&lt;BR /&gt; private&lt;BR /&gt; contains&lt;BR /&gt; final::dispose&lt;BR /&gt; end type t_test&lt;BR /&gt;contains&lt;BR /&gt; subroutine dispose(this)&lt;BR /&gt; type(t_test)::this&lt;BR /&gt; write (*,*) "destructor"&lt;BR /&gt; end subroutine dispose&lt;BR /&gt;end module m_test&lt;BR /&gt;&lt;BR /&gt;program MyApplication&lt;BR /&gt; use m_test&lt;BR /&gt; type(t_test),pointer::single_ptr&lt;BR /&gt; type(t_test),allocatable::single_alloc&lt;BR /&gt; type(t_test),allocatable::array_alloc(:)&lt;BR /&gt; type(t_test),pointer::pointer_alloc(:)&lt;BR /&gt; !--&lt;BR /&gt; write (*,*) "Single pointer works as expeted"&lt;BR /&gt; allocate(single_ptr)&lt;BR /&gt; deallocate(single_ptr)&lt;BR /&gt; !--&lt;BR /&gt; write (*,*) "Single allocatable works as expeted"&lt;BR /&gt; allocate(single_alloc)&lt;BR /&gt; deallocate(single_alloc)&lt;BR /&gt; !--&lt;BR /&gt; write (*,*) "Array allocatable does not invoke Dispose()"&lt;BR /&gt; allocate(array_alloc(1:1))&lt;BR /&gt; deallocate(array_alloc)&lt;BR /&gt; ! deallocate(array_alloc(1:1))&lt;BR /&gt; !--&lt;BR /&gt; write (*,*) "Array-pointer does not invoke Dispose()"&lt;BR /&gt; allocate(pointer_alloc(1:1))&lt;BR /&gt; deallocate(pointer_alloc)&lt;BR /&gt;end program MyApplication&lt;BR /&gt;&lt;BR /&gt;---Result---&lt;BR /&gt;Single pointer works as expeted&lt;BR /&gt;destructor&lt;BR /&gt;Single allocatable works as expeted&lt;BR /&gt;destructor&lt;BR /&gt;Array allocatable does not invoke Dispose()&lt;BR /&gt;Array-pointer does not invoke Dispose()&lt;BR /&gt;&lt;BR /&gt;The result does not depend on array size (1:1 or 1:3 ...)&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Dec 2011 05:50:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759951#M15438</guid>
      <dc:creator>sugimoto605</dc:creator>
      <dc:date>2011-12-07T05:50:04Z</dc:date>
    </item>
    <item>
      <title>Final procedure does not work for array elements ?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759952#M15439</link>
      <description>The selection of the final procedure is based off the rank of the thing being finalized, just like the selection of generic procedures (except final procedures only ever have one argument). &lt;BR /&gt;&lt;BR /&gt;If you wanted your procedure to be called when finalizing any array you could make it elemental. Alternatively provide a final procedure that takes a rank one array.</description>
      <pubDate>Wed, 07 Dec 2011 07:05:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759952#M15439</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2011-12-07T07:05:10Z</dc:date>
    </item>
    <item>
      <title>Final procedure does not work for array elements ?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759953#M15440</link>
      <description>Thanks! The following module works fine:&lt;BR /&gt;module m_test&lt;BR /&gt; private&lt;BR /&gt; public::t_test&lt;BR /&gt; type t_test&lt;BR /&gt; private&lt;BR /&gt; contains&lt;BR /&gt; final::dispose,disposes&lt;BR /&gt; end type t_test&lt;BR /&gt;contains&lt;BR /&gt; subroutine dispose(this)&lt;BR /&gt; type(t_test)::this&lt;BR /&gt; write (*,*) "destructor"&lt;BR /&gt; end subroutine dispose&lt;BR /&gt; subroutine disposes(this)&lt;BR /&gt; type(t_test)::this(:)&lt;BR /&gt; write (*,*) "destructor2"&lt;BR /&gt; end subroutine disposes&lt;BR /&gt;end module m_test&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Dec 2011 09:35:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Final-procedure-does-not-work-for-array-elements/m-p/759953#M15440</guid>
      <dc:creator>sugimoto605</dc:creator>
      <dc:date>2011-12-07T09:35:03Z</dc:date>
    </item>
  </channel>
</rss>

