#REGISTER metastatement

Purpose

Control automatic allocation of Register variables.

Syntax

#REGISTER {ALL | DEFAULT | NONE}

Remarks

Register variables may be Extended-precision floating-point variables, or 16/32-bit integer-class variables (Word, Dword, Integer, or Long).  The #REGISTER metastatement determines the method of automatic allocation of Register variables.

The #REGISTER metastatement works at two levels - a "global" setting, and a "local" setting for each Sub/Function.  To set the global default #REGISTER options, it must precede all executable code.  To override the global register option for an individual Sub or Function, it must be placed between the FUNCTION/END FUNCTION and SUB/END SUB pairs before any executable code.

ALL

#REGISTER ALL requests automatic allocations of all possible Register variables, both integer-class and Extended-precision float variables.

DEFAULT

#REGISTER DEFAULT (default) requests automatic allocations of integer-class variables in all cases, and Extended-precision floating-point variables located in a Sub or Function which contains no reference to another Sub or Function.

NONE

#REGISTER NONE disables automatic assignment of Register variables.  You can still use the REGISTER statement to explicitly define Register variables in your code on an individual basis.  This provides a way to hand-optimize your code to help obtain the utmost performance.

See also

REGISTER, Optimizing your code

Example

#REGISTER DEFAULT                ' global register setting

FUNCTION PBMAIN() AS LONG

  #REGISTER NONE                 ' No automatic register

                                 ' vars in this function

  REGISTER x&                    ' Explicitly declare x&

  …

  END FUNCTION