<?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: saved the allocatables! in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977904#M25422</link>
    <description>Hot diggity! &lt;BR /&gt;Took me 3 hours of fooling w/ it through access/vba tofind this out. &lt;BR /&gt; &lt;BR /&gt;Thanks, Tim</description>
    <pubDate>Thu, 20 Dec 2001 08:42:59 GMT</pubDate>
    <dc:creator>rahzan</dc:creator>
    <dc:date>2001-12-20T08:42:59Z</dc:date>
    <item>
      <title>saved the allocatables!</title>
      <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977902#M25420</link>
      <description>Normally the variables in a subroutine are saved from call to call. However, it seems that allocatables are not (and in fact automatically deallocated) upon exit from the subroutine. Is this true? &lt;BR /&gt; &lt;BR /&gt;Here is the context I found this; &lt;BR /&gt; &lt;BR /&gt;subroutine X_X         !this happens to be a COM server method &lt;BR /&gt;     call  Y &lt;BR /&gt;... &lt;BR /&gt;     call Y &lt;BR /&gt;.... &lt;BR /&gt;end sub X_X &lt;BR /&gt; &lt;BR /&gt;subroutine Y &lt;BR /&gt;real,allocatable::  A(:) &lt;BR /&gt;if(firsttime in Y) allocate(A) &lt;BR /&gt;call Z(A,sizeA) &lt;BR /&gt;end sub Y     &lt;BR /&gt; &lt;BR /&gt;subroutine Z(A,sizeA) &lt;BR /&gt;real A(sizeA) &lt;BR /&gt;... &lt;BR /&gt;end sub Z &lt;BR /&gt; &lt;BR /&gt;On second call to Y and hence into Z, the server crashes as soon as anything in Z (or Y, I presume) refers to A. The problem goes away if I allocate and deallocate A every time Y is called. &lt;BR /&gt; &lt;BR /&gt;Is this the correct behavior? &lt;BR /&gt; &lt;BR /&gt;Tim</description>
      <pubDate>Thu, 20 Dec 2001 06:00:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977902#M25420</guid>
      <dc:creator>rahzan</dc:creator>
      <dc:date>2001-12-20T06:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: saved the allocatables!</title>
      <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977903#M25421</link>
      <description>Yes, that is the correct behavior according to the standard.  Please don't depend on implicit SAVE semantics for local variables - use SAVE if that's what you want.  The only case where you can omit SAVE (but it doesn't hurt) is non-derived-type variables given an initial value through DATA or an initialization clause.  (Derived type variables whose type specifies default initialization are NOT implicitly SAVEd, per the standard.)&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Thu, 20 Dec 2001 06:30:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977903#M25421</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-12-20T06:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: saved the allocatables!</title>
      <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977904#M25422</link>
      <description>Hot diggity! &lt;BR /&gt;Took me 3 hours of fooling w/ it through access/vba tofind this out. &lt;BR /&gt; &lt;BR /&gt;Thanks, Tim</description>
      <pubDate>Thu, 20 Dec 2001 08:42:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977904#M25422</guid>
      <dc:creator>rahzan</dc:creator>
      <dc:date>2001-12-20T08:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: saved the allocatables!</title>
      <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977905#M25423</link>
      <description>I have a reverse problem.  In most of my subroutines, the values are preserved between calls, although I don't bank on it.  For one application however, I would like to start from scratch each time a subroutine is called.  Is there any way of doing this other than resetting all the variables on input?  I haven't yet found anything in the textbooks or help - I want a re-initialisation facility. &lt;BR /&gt; &lt;BR /&gt;Bear of little brain</description>
      <pubDate>Thu, 20 Dec 2001 18:06:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977905#M25423</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-12-20T18:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: saved the allocatables!</title>
      <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977906#M25424</link>
      <description>The only way to do this automatically is to make the variable be of derived type, where the type specifies default initialization.  For example:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+0"&gt;
subroutine sub
type mytype
  integer :: i = 0
  end type mytype
type(mytype) localvar
...
&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Now each time the subroutine is entered, localvar%i will be reset to zero.  Of course, it would be simpler to just add the initialization yourself!&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 21 Dec 2001 02:50:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977906#M25424</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-12-21T02:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: saved the allocatables!</title>
      <link>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977907#M25425</link>
      <description>Bear, &lt;BR /&gt;Could it be that a PURE declaration do what you want?</description>
      <pubDate>Fri, 21 Dec 2001 03:59:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/saved-the-allocatables/m-p/977907#M25425</guid>
      <dc:creator>rahzan</dc:creator>
      <dc:date>2001-12-21T03:59:56Z</dc:date>
    </item>
  </channel>
</rss>

