BC.EXE "Out of Memory" with Numeric Array Elements and SWAP (67314)
This article was previously published under Q67314
SYMPTOMS
Compiling the following code segment with the BC.EXE compiler gives a
"BC : Out of memory" error. The problem will occur for any simple
mathematical operation (addition, subtraction, multiplication, or
division) performed on the two static-array elements appearing in the
assignment statement below. The problem does not occur in the QBX.EXE
environment.
DIM d#(1), e#(1), b!(1), c&(1)
n = 1
a% = b!(n) + c&(n)
SWAP d#(n), e#(n)
WORKAROUND
You can work around the problem in any one of the following ways:
- Compile the program with the BC /D option to produce debug code.
- Use the CINT or CLNG function to convert the first array element in
the mathematical expression to an integer type. The example above
will compile without error if the assignment statement is changed
as follows:
a%= CINT(b!(n)) + c&(n)
- Save one of the variables being swapped to a temporary variable and
use the temporary variable as an argument to the SWAP statement.
The example above will compile without error if the SWAP statement
is changed as follows:
f# = d#(n)
SWAP f#,e#(n)
- Use dynamic arrays (instead of static arrays) by adding
REM $DYNAMIC to the top of the program.
STATUS
Microsoft has confirmed this to be a bug in BC.EXE in Microsoft
Basic Profession Development System (PDS) versions 7.00 and 7.10 for
MS-DOS and MS OS/2. We are researching this problem and will post new
information here in the Microsoft Knowledge Base as it becomes available.
Modification Type: |
Minor |
Last Reviewed: |
1/9/2003 |
Keywords: |
KB67314 |
|