02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's 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>HP</strong> <strong>Fortran</strong> statements<br />

COMMON<br />

COMMON a,b,c /x/y,x,d //w,r<br />

COMMON /cap/hat,visor, //tax, /x/o,t<br />

are equivalent to:<br />

COMMON a,b,c,w,r,tax<br />

COMMON /x/y,x,d,o,t<br />

COMMON /cap/hat,visor<br />

Unlike named common blocks, blank common can differ in size in different scoping units.<br />

However, blank common cannot be initialized.<br />

As an extension, <strong>HP</strong> <strong>Fortran</strong> saves all common blocks in static memory.<br />

The following restrictions apply to the use of common blocks:<br />

268<br />

All common block names must be distinct from subprogram names.<br />

The size of a named common block must be the same in all program units where it is<br />

declared. Note, however, that the size of blank common can differ.<br />

The following data items must not appear in a COMMON statement:<br />

Dummy arguments in a subprogram<br />

Functions, subroutines, or intrinsic functions<br />

Pointees declared by Cray-style pointers<br />

Variables accessible by use association<br />

Automatic entities, including automatic character strings<br />

Allocatable arrays<br />

Derived-type objects may appear in common if they have been defined with the SEQUENCE<br />

attribute.<br />

A variable can only appear in one COMMON statement within a program unit.<br />

Zero-sized common blocks are allowed. Zero-sized common blocks with the same name are<br />

storage associated.<br />

Array bounds in a COMMON statement must be constant specification expressions.<br />

A pointer may appear in common if it has the same type, type parameter, and rank in<br />

every instance of that common block.<br />

Initializing common blocks<br />

As an extension to the Standard, <strong>HP</strong> <strong>Fortran</strong> allows common blocks to be initialized outside of<br />

a block data program unit; for example, in a subroutine. However, note that all data<br />

initialization for a given common block must occur in the same compilation unit.<br />

Chapter 10

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

Saved successfully!

Ooh no, something went wrong!