Article ID: 78562
Article Last Modified on 8/16/2005
APPLIES TO
- Microsoft QuickBasic 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBasic 4.5 for MS-DOS
- Microsoft BASIC Professional Development System 7.0
- Microsoft BASIC Professional Development System 7.1
- Microsoft BASIC Compiler 6.0
- Microsoft BASIC Compiler 6.0b
- Microsoft GW-BASIC 3.2
- Microsoft GW-BASIC 3.22
- Microsoft GW-BASIC 3.23
This article was previously published under Q78562
SUMMARY
QB.EXE, QBX.EXE, and BC.EXE report the error "Array already dimensioned" when an array is used above the code where it is dimensioned, even if the flow of control would reach the DIM statement before reaching the use of the array. BC.EXE reports the warning "Array not dimensioned" when it encounters an array that is not dimensioned before it is used. These error messages occur regardless of whether an array is dynamic or static.
These error messages do not occur in GW-Basic programs that dimension arrays after they are used as long as the DIM statement is encountered at run-time before the usage.
MORE INFORMATION
QuickBasic analyzes array declarations differently than GW-Basic. QuickBasic analyzes explicitly- and implicitly-dimensioned arrays in one top-to-bottom pass through the source file at compile time. GW-Basic dimensions arrays in the order that they are encountered at run time.
The following code example illustrates this difference. It runs under GWBasic.EXE but not under QB.EXE, QBX.EXE, or BC.EXE:
10 REM $DYNAMIC 20 GOSUB 50 30 A(5) = 0 ' BC.EXE reports: "Array not dimensioned" 40 END 50 DIM A(20) ' QB.EXE, QBX.EXE, BC.EXE: "Array already dimensioned" 60 RETURN
Additional query words: QuickBas BasicCom 3.20 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10
Keywords: KB78562