24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>FORTRAN</strong> Statements<br />

2.13 COMMON Statement<br />

<br />

COMMON [/[cb]/] nlist [[,]/[cb]/ nlist] ...<br />

where:<br />

cb<br />

nlist<br />

is a common block name.<br />

is a list of names each separated by a comma.<br />

If cb is omitted, the blank common block is assumed. If specified, cb is called a named common block.<br />

The names appearing in nlist can be variable names, array names, and array declarators. Dummy<br />

arguments are not allowed in nlist.<br />

The COMMON statement allows sharing of blocks of storage between subprograms. Each name appearing in<br />

the nlist following a common block name cb is declared to belong to that common block. A variable or<br />

an array name can belong to only one common block. A common block name can occur more than once in<br />

the same COMMON statement as well as in more than one COMMON statement. Lists following successive<br />

appearances of the same common block name in COMMON statements are considered a continuation of the<br />

list of names belonging to the common block. A variable or an array can appear in a COMMON statement<br />

only once.<br />

Common blocks are defined as follows. A common block is one consecutive block of storage. It consists<br />

of all the storage sequences of all the entities specified in all the lists declared to belong to that common<br />

block. The order in which each entity appears in a common block is defined by the order in which they<br />

appear in the lists. Storage sequences associated to a common block through the EQUIVALENCE statement<br />

are considered to belong to that common block. In this way a common block may only be extended beyond<br />

the last storage unit. The size of a common block is the sum of all the storage sequences of all the names<br />

belonging to that common block plus any storage sequence which extends the common block through<br />

equivalence association.<br />

An EQUIVALENCE statement must not cause storage sequences of two different common blocks to<br />

become associated nor should they extend the common block by adding storage units preceding the first<br />

storage unit of the common block.<br />

Example:<br />

DIMENSION A(5)<br />

COMMON /COMBLK/ A,B(10),C<br />

In this example, the common block COMBLK contains the array A followed by the array B and finally the<br />

variable C.<br />

COMMON Statement 31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!