Microsoft KB Archive/32222

= Passing DYNAMIC and STATIC Arrays in COMMON; Macintosh BASIC =

Article ID: 32222

Article Last Modified on 11/21/2006



This article was previously published under Q32222



SUMMARY
Passing STATIC and DYNAMIC arrays in COMMON differs for compiled and interpreted Macintosh QuickBASIC programs. The order in which arrays are declared in COMMON and dimensioned is crucial for the compiler. Because either of the compiler formats is acceptable under the interpreter, Microsoft recommends following the syntax rules for compiled programs, as shown in formats 1 and 2 below.



MORE INFORMATION
The formats for DYNAMIC and STATIC arrays in COMMON for the compiler and interpreter are as follows:

  The following information pertains to passing STATIC arrays in COMMON in a compiled program:

The DIM STATIC statement (or the DIM statement when the &quot;Use Static Arrays&quot; option is on) must come before the COMMON declaration. The array name in the COMMON declaration must be followed by empty parentheses, as shown below: DIM STATIC A(20,20) COMMON A   The following information pertains to passing DYNAMIC arrays in COMMON in a compiled program:

The DIM statement must come after the COMMON declaration. The array name in the COMMON declaration must be followed by the number of dimensions (not the sizes of the dimensions) in parentheses as shown below: COMMON A(2) DIM A(20,20)  The following information pertains to passing DYNAMIC arrays in COMMON in an interpreted program:

The COMMON declaration may come before or after the DIM statement in the interpreter. The array name in the COMMON declaration may be followed by the number of dimensions (not the sizes of the dimensions) in parentheses, or the array name may be followed by empty parentheses. The following information pertains to STATIC arrays in an interpreted program:

There are no STATIC arrays in an interpreted program. Although you may use DIM STATIC in the interpreter, it allocates only DYNAMIC arrays. The STATIC keyword in a DIM statement is ignored by the interpreter. Because either of the compiler formats is accepted by the QuickBASIC interpreter, Microsoft recommends following the rules for compiled programs.

Additional query words: MQuickB

Keywords: KB32222

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.