advr.hlp (Topic list)
$STATIC, $DYNAMIC Metacommands Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 {REM | '} $STATIC
 {REM | '} $DYNAMIC
 
 Usage Notes
   ■ The DIM and REDIM statements usually provide a better way to specify
     whether arrays are dynamic or static. You can also use REDIM to change
     the size of an array allocated using $DYNAMIC.
     See: DIM Statement  REDIM Statement
 
   ■ When $STATIC is used, the ERASE statement reinitializes all array values
     to zero (numeric arrays) or to a null string (string arrays), but does
     not remove the array from memory. See: ERASE Statement
 
   ■ When $DYNAMIC is used, array storage is allocated while the program is
     running. Thus, the ERASE statement removes the array from memory and
     frees up space for other uses.
 
   ■ $STATIC and $DYNAMIC metacommands affect all arrays except implicitly
     dimensioned arrays (arrays not declared in a DIM statement). By default,
     implicitly dimensioned arrays are always allocated as if $STATIC had
     been used.
 
   ■ A DIM statement declared with a static array is a declarative statement;
     a DIM statement declared with a dynamic array is an executable
     statement.
 
   ■ All arrays inside a SUB or FUNCTION procedure are dynamic unless the
     STATIC keyword is included in the SUB or FUNCTION statement.
     See: FUNCTION Statement  SUB Statement
 
   ■ The STATIC statement, STATIC keyword, and $STATIC metacommand are all
     used to affect variables and arrays. Their usage differs as follows:
 
     Usage                      Description
     ═══════════════════════    ════════════════════════════════════════════
     STATIC keyword in SUB      Declares the default for variables as fixed
     and FUNCTION statements    or static; variables with the same name as
                                variables shared by module-level code are
                                still shared
 
     STATIC statement           Makes specific variables static; overrides
                                any variables shared by module-level code
 
     $STATIC metacommand        Affects how memory is allocated for arrays
 
     See: STATIC Keyword  STATIC Statement