AUTO (uninitialized variable)

Top  Previous  Next

 

AUTO

The AUTO attribute allows a non-static or non-threaded variable to be allocated uninitialized stack memory. Without the AUTO attribute, a numeric variable is initialized to zero and a string variable is initialized to all blanks when its memory is assigned at run-time.

The AUTO attribute is used when you do not need to rely on an initial blank or zero value because you intend to assign some other value to the variable. This saves a small amount of run-time memory by eliminating the internal code necessary to perform the automatic initialization for the variable.

When an ANY data type is declared outside of a structure, the AUTO attribute is ignored. When a structure containing an ANY has the AUTO attribute, you must first CLEAR the entire structure before you can access variables of type ANY.

Example:

SomeProc  PROCEDURE

SaveCustID LONG,AUTO     !Non-initialized local variable

 

See Also:

Data Declarations and Memory Allocation