Mac BASIC Interpreter Allocates DYNAMIC Arrays, Never STATIC (32223)






This article was previously published under Q32223

SUMMARY

The interpreter in QuickBASIC Version 1.00 for Macintosh supports only DYNAMIC arrays. (The same is true for the BASIC interpreter Versions 3.00 and earlier.) The compiler supports both STATIC and DYNAMIC arrays.

The STATIC keyword in a DIM statement is ignored by the QuickBASIC interpreter, and the array is made DYNAMIC. In the older BASIC interpreter Versions 3.00 and earlier, the DIM STATIC statement gives a "Syntax Error" message when executed and does not dimension the array.

MORE INFORMATION

STATIC arrays are allocated space at compile time, and cannot be removed from memory with the ERASE statement. Accessing STATIC arrays is faster than accessing DYNAMIC arrays.

DYNAMIC arrays are allocated space at run time, and can be removed from memory with the ERASE statement, which allows more flexible memory management than STATIC arrays when memory is tight. Using DYNAMIC arrays in a program makes it slower than if it were using STATIC arrays.

Although you may use DIM STATIC in the QuickBASIC interpreter, it allocates only DYNAMIC arrays. The STATIC keyword in a DIM statement is ignored by the QuickBASIC interpreter. Because either of the compiler formats would be acceptable under the QuickBASIC interpreter, Microsoft recommends following the rules for the compiler.

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB32223