I’m trying to optimize a code in fortran77 and I’d like to know whether the arrays declared in the following way inside a routine or an header file are arrays of pointers or arrays of structures:
case 1: real*8 xred(maxatm)
case 2: common /atoms/ x(maxatm)
I’ve already searched over the internet but I couldn’t find any info on this, the only thing I found was that when you pass an array to a routine it is passed by reference. But regarding when it is declared in header file or inside the routine I found nothing.
Thanks in advance!
Within a .f77 ‘header’/common/.CMN file you are declaring your variables to be used within your program. The space required for these variables is established at compile time for each file that contains the header declaration. So for ‘My.CMN’ which contains
These variables are created each time they are declared in a .f77 file via
INCLUDE 'My.CMN'.However, using a common block
tells the compiler that the variables contained within a given .CMN file (or whatever) are to some extend global/shared, here the compiler will use pointers to the relevent space in memory.
See here for more information on
COMMONand here for the Sun FORTRAN 77 4.0 Compiler Reference Manual.