<?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: Replacement for COMMON in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844432#M62401</link>
    <description>Question: Can I have multiple different modules?  As in:&lt;BR /&gt;&lt;BR /&gt;module one&lt;BR /&gt;integer a, b, c, d&lt;BR /&gt;end module one&lt;BR /&gt;&lt;BR /&gt;module two&lt;BR /&gt;integer e, f, g, h&lt;BR /&gt;end module two&lt;BR /&gt;&lt;BR /&gt;subroutine check&lt;BR /&gt;use two&lt;BR /&gt;use one&lt;BR /&gt;end subroutine check&lt;BR /&gt;&lt;BR /&gt;Is that possible?  thanks.</description>
    <pubDate>Wed, 12 Jun 2002 04:12:19 GMT</pubDate>
    <dc:creator>waynebruce</dc:creator>
    <dc:date>2002-06-12T04:12:19Z</dc:date>
    <item>
      <title>Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844428#M62397</link>
      <description>I am tired of having to pass variables back and forth across subroutines.  I also do not wish to use COMMON statements in the old Fortran.  Is there a way to do so in CVF?  I am not too familier with POINTERS, so not sure how that would work.  Maybe some info that'll get me started?  I am trying to work my way through the POINTERs section in the help file, but it's not exactly a tutorial, and is kind of cryptic in its explanation.</description>
      <pubDate>Wed, 12 Jun 2002 00:59:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844428#M62397</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T00:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844429#M62398</link>
      <description>First, you should never get "tired" when programming, it leads to shortcuts which ultimately will produce further problems down the road.&lt;BR /&gt;&lt;BR /&gt;What you likely want is not pointers, but derived types.  This will allow you to define numerous "variables" that are referenced in masse by the name of the derived type.&lt;BR /&gt;&lt;BR /&gt;So instead of having to do:&lt;BR /&gt;&lt;BR /&gt;call sub (a, b, c, d, e, f)&lt;BR /&gt;call sub2 (a, c, d, e, g)&lt;BR /&gt;&lt;BR /&gt;You would instead have something like:&lt;BR /&gt;&lt;BR /&gt;call sub (t)&lt;BR /&gt;call sub2 (t)&lt;BR /&gt;&lt;BR /&gt;Of course you will have to reference each of the original variables as t%a, t%b, t%c, etc.&lt;BR /&gt;&lt;BR /&gt;James</description>
      <pubDate>Wed, 12 Jun 2002 01:48:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844429#M62398</guid>
      <dc:creator>james1</dc:creator>
      <dc:date>2002-06-12T01:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844430#M62399</link>
      <description>I would suggest the standard Fortran feature of modules, rather than derived types.  Variables declared in modules are a great replacement for COMMON.&lt;BR /&gt;&lt;BR /&gt;An example:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;
module mymod
integer a,b,c,d
end module mymod

subroutine sub1
use mymod
... a,b,c,d now available
end subroutine mymod
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;See the Language Reference Manual, or a good Fortran 9x tutorial, for more on modules.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Wed, 12 Jun 2002 01:57:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844430#M62399</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2002-06-12T01:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844431#M62400</link>
      <description>Modules seem good.  lemme try that.  thanks for the suggestions.</description>
      <pubDate>Wed, 12 Jun 2002 02:39:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844431#M62400</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T02:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844432#M62401</link>
      <description>Question: Can I have multiple different modules?  As in:&lt;BR /&gt;&lt;BR /&gt;module one&lt;BR /&gt;integer a, b, c, d&lt;BR /&gt;end module one&lt;BR /&gt;&lt;BR /&gt;module two&lt;BR /&gt;integer e, f, g, h&lt;BR /&gt;end module two&lt;BR /&gt;&lt;BR /&gt;subroutine check&lt;BR /&gt;use two&lt;BR /&gt;use one&lt;BR /&gt;end subroutine check&lt;BR /&gt;&lt;BR /&gt;Is that possible?  thanks.</description>
      <pubDate>Wed, 12 Jun 2002 04:12:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844432#M62401</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T04:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844433#M62402</link>
      <description>Yes, and that is a good way to reduce potential naming collisions with the global variables you are defining in the various modules.&lt;BR /&gt;&lt;BR /&gt;James</description>
      <pubDate>Wed, 12 Jun 2002 04:31:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844433#M62402</guid>
      <dc:creator>james1</dc:creator>
      <dc:date>2002-06-12T04:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844434#M62403</link>
      <description>What does it mean "A specification statement cannot appear in the executable section."?  Does it mean I can't have modules in the PROGRAM file, but instead have to have it in a SUBROUTINE file?</description>
      <pubDate>Wed, 12 Jun 2002 04:37:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844434#M62403</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T04:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844435#M62404</link>
      <description>You probably placed your USE statement after an executable statement in the body of your program.  Try placing any USE statements immediately following the PROGRAM line.&lt;BR /&gt;&lt;BR /&gt;James</description>
      <pubDate>Wed, 12 Jun 2002 04:46:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844435#M62404</guid>
      <dc:creator>james1</dc:creator>
      <dc:date>2002-06-12T04:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844436#M62405</link>
      <description>I'm sorry, still having trouble with this.  I currently have something like this:&lt;BR /&gt;&lt;BR /&gt;PROGRAM MAIN&lt;BR /&gt;&lt;BR /&gt;MODULE ONE&lt;BR /&gt;     ...module declarations&lt;BR /&gt;END MODULE ONE&lt;BR /&gt;&lt;BR /&gt;...begin main program declarations&lt;BR /&gt;...main program&lt;BR /&gt;END &lt;BR /&gt;&lt;BR /&gt;That didn't work at all.  The only way I can get the error message to go away is like this:&lt;BR /&gt;&lt;BR /&gt;PROGRAM MAIN&lt;BR /&gt;...main program&lt;BR /&gt;END&lt;BR /&gt;&lt;BR /&gt;MODULE ONE&lt;BR /&gt;   ...module declarations&lt;BR /&gt;END MODULE ONE&lt;BR /&gt;&lt;BR /&gt;Now that's fine 'n all, but wouldn't that imply the module existed outside the main program?  How would the main program, let along the subroutines, know that the MODULE is sitting there, since the main program doesn't even get there until after it ended?</description>
      <pubDate>Wed, 12 Jun 2002 05:05:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844436#M62405</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T05:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844437#M62406</link>
      <description>Programs and modules are program units and are defined separately (i.e. not nested).  Typically modules are defined in separate files, and when you compile them you get .MOD files which are what the USE statements look for.&lt;BR /&gt;&lt;BR /&gt;If you have everything in one source file, you simply need to have the MODULE defined prior to any USE statement that refers to it in a subsequent program unit.&lt;BR /&gt;&lt;BR /&gt;James&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Jun 2002 05:33:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844437#M62406</guid>
      <dc:creator>james1</dc:creator>
      <dc:date>2002-06-12T05:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844438#M62407</link>
      <description>I see.  So if I have a separate file containing all my MODULE declarations, and compled to get a .MOD file, the subroutines that contain the USE statements would automatically know where to look, even if the main program doesn't actually call the MODULEs explicitly?</description>
      <pubDate>Wed, 12 Jun 2002 05:46:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844438#M62407</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T05:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844439#M62408</link>
      <description>One last question.  Can I modify the values of the variables defined in the Modules?  For example, if I declared INTEGER a, b, c in a module, then I made changes to all the integers through various operations, are the values now carried across?  Would another subroutine see the new values if it used the same module again?&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;&lt;BR /&gt;Wayne</description>
      <pubDate>Wed, 12 Jun 2002 06:35:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844439#M62408</guid>
      <dc:creator>waynebruce</dc:creator>
      <dc:date>2002-06-12T06:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replacement for COMMON</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844440#M62409</link>
      <description>Yes.  Typically, each MODULE goes in its own source file.  If you are using Developer Studio, it will automatically build everything in the right order.  Also, one module can USE another module, which sometimes makes sense.  Group related declarations in a single module.&lt;BR /&gt;&lt;BR /&gt;Modules can contain variables, PARAMETER constants, derived types and routines.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Wed, 12 Jun 2002 06:37:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Replacement-for-COMMON/m-p/844440#M62409</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2002-06-12T06:37:09Z</dc:date>
    </item>
  </channel>
</rss>

