02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>HP</strong> <strong>Fortran</strong> statements<br />

EQUIVALENCE<br />

Consider the following example, which puts array i in blank common and equivalences array<br />

element j(2) to i(3):<br />

INTEGER :: i(6), j(6)<br />

COMMON i<br />

EQUIVALENCE (i(3), j(2))<br />

The effect of the EQUIVALENCE statement is to extend blank common to include element j(6).<br />

This is entirely legal because the extension occurs at the end of the common block.<br />

But if the EQUIVALENCE statement were changed as follows:<br />

EQUIVALENCE (i(1), j(2)) ! illegal<br />

it would result in an illegal equivalence, because storage would have to be inserted in front of<br />

the block in order to accommodate element j(1).<br />

Examples<br />

In the following example, the variables a, b, andc share the same storage space; array<br />

elements d(2) and e(5) share the same storage space; variables f, g, andh share the same<br />

storage:<br />

INTEGER :: a, b, c, d(20), e(30), f, g, h<br />

EQUIVALENCE (a, b, c), (d(2), e(5)), (f, g, h)<br />

Related statements<br />

COMMON<br />

Related concepts<br />

For information about data alignment, see Table 3-1 and “Alignment of derived-type objects”<br />

on page 45.<br />

322<br />

Chapter 10

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

Saved successfully!

Ooh no, something went wrong!