Re: Common block file



Shawn wrote:
At least if it is one file you know that the variables have the same
name in all routines using that file. Are the declaration statements
for those variables also in the include file?

-- glen

The include file is basically a large globals variable declaration
list. The bulk of the files are auto declared using the i-n option
with character vars being explicitly declared. The actual program
uses this list with very little variable passing otherwise. Or did I
miss the question?

Shawn

In that case you are going to have to keep the common statement inside the module - because it's the only declaration of the variables. That doesn't hurt, but it will make it a bit more awkward to make some other modernisations/improvements (such as making some of the arrays allocatable, allowing greater flexibility in the size of problem you can consider) - you can't do that with an array in common, but you can with an array in a module. Now of course you can remove the arrays from the COMMON statements (they must already be declared elsewhere to dimension them) but if the common blocks also contain scalar variables, you'll have to do it on an individual basis. If your code contains any use of EQUIVALENCE, you'll need to be very wary at this point, and run a bunch of before-and-after test cases to check for any storage association which this has screwed up.

Otherwise what I would suggest as a next step would be simply to remove the COMMON line(s), leaving the module containing just variable declarations.

--
Catherine Rees Lay

Polyhedron Software Ltd. Registered Office: Linden House,
93 High St, Standlake, Witney, OX29 7RH, United Kingdom.
Registered in England No.2541693. Vat Reg No. GB 537 3214 57
.



Relevant Pages

  • Re: Common programming mistakes?
    ... I think of some kind of list that states the most common ... programming errors together with their frequency and the cost to find ... a declaration hides another declaration ... uninitialized memory (eg: using malloc and forgetting to use memset or such ...
    (comp.lang.misc)
  • Re: Fortran Standard question: COMMON, SAVE and EQUIVALENCE
    ... the main program declares a blank common block of length 149. ... but one declaration isn't the master one. ... subroutine sub ...
    (comp.lang.fortran)
  • Re: Return value of _time64() in VS2005
    ... >The common description of timeand _time64() says that the function ... >declaration above. ... referring to times between 1903 and 1970. ...
    (microsoft.public.vc.language)
  • Re: Declaration order
    ... but not with Compaq v6.6: ... The declaration of the array comes before the declaration of its ... dimension which comes through a common block. ... supplying the value of myn ...
    (comp.lang.fortran)
  • Re: anonymous initializer problem
    ... the declaration section (via initializer). ... and has only one public constructor that takes an array of field objects. ... This way I could define my dictionary in the declaration section where it is ... costructor declare custom static arrays that use the dictionary values, ...
    (microsoft.public.dotnet.languages.csharp)