<?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 Simple array question in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Simple-array-question/m-p/980464#M25965</link>
    <description>Hi, &lt;BR /&gt;I am a C++ programmer working for the first time on some legacy Fortran code.  My question is whether Fortran guarantees anything about whether local variables are initialized to 0 at the beginning of a subroutine - or is the initial value whatever is at some chunch of memory, i.e. garbage? &lt;BR /&gt;Is this the same for the values in a "Dimension"ed variable? &lt;BR /&gt; &lt;BR /&gt;I have (at the beginning of a subroutine): &lt;BR /&gt; &lt;BR /&gt;DIMENSION SIGN(10,1) &lt;BR /&gt; &lt;BR /&gt;One branch of the code sets SIGN(5,1) to 1.0, the other branch doesn't mention SIGN(5,1).  Later this value is queried and tested against 1.0 or 0.0.  So either it defaults to 0.0 or this code contains an error. &lt;BR /&gt; &lt;BR /&gt;-------------------------------- &lt;BR /&gt; &lt;BR /&gt;Question 2: &lt;BR /&gt; &lt;BR /&gt;Pertaining to the same variable SIGN above, later the code loops with a counter COLUMN and starts assigning values to  &lt;BR /&gt; &lt;BR /&gt;SIGN(2, COLUMN) &lt;BR /&gt; &lt;BR /&gt;where COLUMN starts as 1 and increment to 8.   &lt;BR /&gt; &lt;BR /&gt;Isn't this blowing the array bounds?  I didn't think (at least older Fortran) would allow and even automate dynamic array sizing.  Is this program writing to memory that doesn't belonging to it? &lt;BR /&gt; &lt;BR /&gt;Thanks a lot for your help, &lt;BR /&gt;Matthew.</description>
    <pubDate>Fri, 18 Jan 2002 09:36:20 GMT</pubDate>
    <dc:creator>Intel_C_Intel</dc:creator>
    <dc:date>2002-01-18T09:36:20Z</dc:date>
    <item>
      <title>Simple array question</title>
      <link>https://community.intel.com/t5/Software-Archive/Simple-array-question/m-p/980464#M25965</link>
      <description>Hi, &lt;BR /&gt;I am a C++ programmer working for the first time on some legacy Fortran code.  My question is whether Fortran guarantees anything about whether local variables are initialized to 0 at the beginning of a subroutine - or is the initial value whatever is at some chunch of memory, i.e. garbage? &lt;BR /&gt;Is this the same for the values in a "Dimension"ed variable? &lt;BR /&gt; &lt;BR /&gt;I have (at the beginning of a subroutine): &lt;BR /&gt; &lt;BR /&gt;DIMENSION SIGN(10,1) &lt;BR /&gt; &lt;BR /&gt;One branch of the code sets SIGN(5,1) to 1.0, the other branch doesn't mention SIGN(5,1).  Later this value is queried and tested against 1.0 or 0.0.  So either it defaults to 0.0 or this code contains an error. &lt;BR /&gt; &lt;BR /&gt;-------------------------------- &lt;BR /&gt; &lt;BR /&gt;Question 2: &lt;BR /&gt; &lt;BR /&gt;Pertaining to the same variable SIGN above, later the code loops with a counter COLUMN and starts assigning values to  &lt;BR /&gt; &lt;BR /&gt;SIGN(2, COLUMN) &lt;BR /&gt; &lt;BR /&gt;where COLUMN starts as 1 and increment to 8.   &lt;BR /&gt; &lt;BR /&gt;Isn't this blowing the array bounds?  I didn't think (at least older Fortran) would allow and even automate dynamic array sizing.  Is this program writing to memory that doesn't belonging to it? &lt;BR /&gt; &lt;BR /&gt;Thanks a lot for your help, &lt;BR /&gt;Matthew.</description>
      <pubDate>Fri, 18 Jan 2002 09:36:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Simple-array-question/m-p/980464#M25965</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2002-01-18T09:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Simple array question</title>
      <link>https://community.intel.com/t5/Software-Archive/Simple-array-question/m-p/980465#M25966</link>
      <description>No, Fortran makes no guarantees about the initial value of any variable, unless you explicitly initialize it.&lt;BR /&gt;&lt;BR /&gt;Regarding array bounds checking - bounds checking is on by default when building in Developer Studio as a Debug configuration, but is off by default otherwise.  If enabled, it should give an error in the case you describe.  Of course, with just a description and not an actual program to look at, it's hard to tell for certain.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 18 Jan 2002 12:27:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Simple-array-question/m-p/980465#M25966</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2002-01-18T12:27:05Z</dc:date>
    </item>
  </channel>
</rss>

