forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
EQUIVALENCE
                                             Up Contents Index Back
─────EQUIVALENCE ───────────────────────────────────────────────────────────
 
     Action
 
     Causes two or more variables or arrays to occupy the same memory
     location.
 
     Syntax
 
     EQUIVALENCE (nlist) [, (nlist)]...
 
     Parameter          Description
 
     nlist              A list of two or more variables, separated by
                        commas.
 
                        The list may not include formal arguments,
                        allocatable arrays, or automatic variables.
 
     Remarks
 
     EQUIVALENCE causes all listed elements to have the same first
     memory location.
 
     There is no automatic type conversion among the elements in
     <nlist>.
 
     The following restrictions apply:
 
        ■ A variable cannot be forced to occupy more than one memory
          location. Two or more elements from the same array cannot
          occupy the same memory location.
 
        ■ Consecutive array elements must be stored in sequential order.
 
        ■ Character and noncharacter entities cannot be associated if
          they start on an even-byte boundary.
 
        ■ An item in <nlist> cannot be initialized in a type statement.
 
        ■ An EQUIVALENCE statement cannot share memory between two
          different common blocks.
 
        ■ An EQUIVALENCE statement can extend a common block by adding
          memory elements following the common block, provided a named
          common block's length remains the same as common name blocks
          with the same name in other program units.
 
        ■ An EQUIVALENCE statement cannot extend a common block by
          adding memory elements preceding the common block.
 
     Example
 
           CHARACTER  name, first, middle, last
           DIMENSION  name(60), first(20), middle(20), last(20)
           EQUIVALENCE (name(1), first(1)), (name(21), middle(1))
           EQUIVALENCE (name(41), last(1))
                                    -♦-