<?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: intent statement for scratch arrays in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/intent-statement-for-scratch-arrays/m-p/1539641#M168961</link>
    <description>&lt;P&gt;intent is maybe a bad name, it serves two purposes IMO as you describe it documents, but it is also a safety guard that stops you passing constants and then trying to modify them and can allow the compiler to see instances when intent out variables are not initialised etc. so it prevents some types of bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if you pass and array and partially modify it a bit in any way it is intent(inout) irrespective of if it is junk in junk out scratch space.&lt;/P&gt;&lt;P&gt;I quick solution for large scratch spaces is to allocate the space in the subroutine and it automatically gets deallocated on exit then all is clear.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2023 01:07:16 GMT</pubDate>
    <dc:creator>andrew_4619</dc:creator>
    <dc:date>2023-11-02T01:07:16Z</dc:date>
    <item>
      <title>intent statement for scratch arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/intent-statement-for-scratch-arrays/m-p/1539590#M168955</link>
      <description>&lt;P&gt;While documenting and modernizing 30 year old fortran 77 code, I do a lot of figuring out what are inputs and outputs to each subroutine and documenting my findings by adding "intent" statements.&amp;nbsp; I understand &lt;EM&gt;in&lt;/EM&gt;, &lt;EM&gt;out&lt;/EM&gt; and &lt;EM&gt;inout&lt;/EM&gt; intents, but I am a bit confused how to label intent of scratch arrays, which are&amp;nbsp; neither input or output.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the original programmer was trying to save precious memory space by reusing no longer needed large statically allocated arrays&amp;nbsp; as as scratch space for subsequent subroutines and we do not care about neither input or output of those subroutines.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realize that probably the best approach is to rewrite the code, so we do not use them, if I find such arrays is there a way to label them as scratch space?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 20:57:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/intent-statement-for-scratch-arrays/m-p/1539590#M168955</guid>
      <dc:creator>Jarek_T</dc:creator>
      <dc:date>2023-11-01T20:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: intent statement for scratch arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/intent-statement-for-scratch-arrays/m-p/1539641#M168961</link>
      <description>&lt;P&gt;intent is maybe a bad name, it serves two purposes IMO as you describe it documents, but it is also a safety guard that stops you passing constants and then trying to modify them and can allow the compiler to see instances when intent out variables are not initialised etc. so it prevents some types of bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if you pass and array and partially modify it a bit in any way it is intent(inout) irrespective of if it is junk in junk out scratch space.&lt;/P&gt;&lt;P&gt;I quick solution for large scratch spaces is to allocate the space in the subroutine and it automatically gets deallocated on exit then all is clear.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 01:07:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/intent-statement-for-scratch-arrays/m-p/1539641#M168961</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2023-11-02T01:07:16Z</dc:date>
    </item>
  </channel>
</rss>

