04-24-2005, 04:31 AM
I can't see what about this little piece of code it is that my
piece of junk XP PC doesn't like, but:
1. This code compiles (using 0.13b).
2. When it runs, I get the classic windows message that "TEST2DIM.EXE has encountered a problem and needs to close."
On 2000 Professional, I get a memory access violation that
it tried to access memory a memory address that couldn't be read.
There are no pointers in this code and all vars are dimmed.
3. This only happened after I made the array a 2 dimensional array.
4. It occurs consistently on the 2nd pass of a nested loop
involving that 2d array, and always at the exact same instance
within the loop.
a. When the DIM statement of the 2d array sets the string
size for 7, it always crashes after Z2 = 2, Z = 953.
b. When the DIM statement of the 2d array sets the string
size for 8, it always crashes after Z2 = 2, Z = 961.
c. Diming the array as a Zstring produces the same results.
DIM X AS LONG
DIM Y AS LONG
DIM Z AS LONG
DIM X2 AS LONG
DIM Z2 AS LONG
DIM S AS STRING
'Tried changing these values, made no difference.
X = 1000
X2 = 20
DIM MyArray(X,X2) AS STRING * 7 : Always crashes after Z=953
'DIM MyArray(X,X2) AS STRING * 8 : Always crashes after Z=961
PRINT "Loading array in descending order..."
FOR Z2 = 1 TO X2 : 'Incrementing Z2 from 1 to 20
PRINT "Z2 outer loop = ";Z2
FOR Z = X TO 1 STEP -1 : 'Decrementing Z from 1000 to 1.
PRINT "Z inner loop = ";Z : 'Crashes after Z2 = 2, Z = 953
S = LTRIM$(STR$(Z))
IF LEN(S) < 7 THEN S = S + STRING$(7 - LEN(S), " ")
Y = Y + 1
MyArray(Y,Z2) = S
NEXT Z
NEXT Z2
INPUT "Hit any key...";g$
I can't see what it is if not a bug in the compiler.
Dean
piece of junk XP PC doesn't like, but:
1. This code compiles (using 0.13b).
2. When it runs, I get the classic windows message that "TEST2DIM.EXE has encountered a problem and needs to close."
On 2000 Professional, I get a memory access violation that
it tried to access memory a memory address that couldn't be read.
There are no pointers in this code and all vars are dimmed.
3. This only happened after I made the array a 2 dimensional array.
4. It occurs consistently on the 2nd pass of a nested loop
involving that 2d array, and always at the exact same instance
within the loop.
a. When the DIM statement of the 2d array sets the string
size for 7, it always crashes after Z2 = 2, Z = 953.
b. When the DIM statement of the 2d array sets the string
size for 8, it always crashes after Z2 = 2, Z = 961.
c. Diming the array as a Zstring produces the same results.
DIM X AS LONG
DIM Y AS LONG
DIM Z AS LONG
DIM X2 AS LONG
DIM Z2 AS LONG
DIM S AS STRING
'Tried changing these values, made no difference.
X = 1000
X2 = 20
DIM MyArray(X,X2) AS STRING * 7 : Always crashes after Z=953
'DIM MyArray(X,X2) AS STRING * 8 : Always crashes after Z=961
PRINT "Loading array in descending order..."
FOR Z2 = 1 TO X2 : 'Incrementing Z2 from 1 to 20
PRINT "Z2 outer loop = ";Z2
FOR Z = X TO 1 STEP -1 : 'Decrementing Z from 1000 to 1.
PRINT "Z inner loop = ";Z : 'Crashes after Z2 = 2, Z = 953
S = LTRIM$(STR$(Z))
IF LEN(S) < 7 THEN S = S + STRING$(7 - LEN(S), " ")
Y = Y + 1
MyArray(Y,Z2) = S
NEXT Z
NEXT Z2
INPUT "Hit any key...";g$
I can't see what it is if not a bug in the compiler.
Dean