Fortran allows for a special, unnamed common block, called the blank COMMON block. It is declared as
common // var_1, var_2, ..., var_nBlank common block is useful when most, or a large number of routines, need to share same variables. Some special features of the blank common block are
In F77 several entities (scalar or array) can be associated with the same memory location, using
equivalence ( var_1, var_2, ..., var_n )All the variables in the list are stored in the same memory locations, more exactly, their storage spaces start at the same address in the memory.
EQUIVALENCE is usually used in conjunction with large common blocks, to identify the parts of the block for the current procedure. For example, a common block /VERY_LONG/ can store 28 real arrays, containing a total of 15,421 real elements
common /very_long/ a(7311), b(121), ..., z(1272)Suppose in a procedure only the second array, B(121) is used; we can use the declaration
real b(121) common /very_long/ blk(15421) equivalence (b, blk(7312))(we employed F77 syntax on purpose).
Sometimes the results of EQUIVALENCE statements are hard to understand. For example
real x, y(2), z complex c equivalence (x,y,c), (y(2), z) c = cmplx(1.0,2.0)has the effect of setting y(1) x REAL(c) = 1.0 and y(2) z AIMAG(c) = 2.0.