Hello - I am finding some strange behaviour with the following code (a shortened version):
===================================
GLOBAL priceitems2 AS LONG
GLOBAL sltype5_lowmap() AS LONG
GLOBAL pricetime2() as LONG
GLOBAL pricedate2() as STRING
===================================
SUB MainLoop()
priceitems2 = 115691
REDIM pricetime2(priceitems2)
REDIM pricedate2(priceitems2)
' code to fill pricetime2() and pricedate2() here - tested OK
doAnalysis()
END SUB
===================================
SUB doAnalysis()
REGISTER i AS LONG
REDIM sltype5_lowmap(priceitems2)
' code to fill sltype5_lowmap(0 - priceitems2) with values here - tested OK
FOR i = 0 TO priceitems2
IF pricetime2(i) = 151600 AND pricedate2(i) = "20070605" THEN
MSGBOX("test output")
MSGBOX(STR$(priceitems2))
MSGBOX(STR$(i))
END IF
NEXT
END SUB
===================================
This produces:
1. msgbox with "test output"
2. GPF error straight after
However, if I place this line of code just before the "for i..." loop:
MSGBOX(STR$(priceitems2))
I then get the following output:
1. msgbox with 115691 (the value of priceitems2: correct)
2. msgbox with "test output"
3. msgbox with 115691 (the value of priceitems2: correct)
4. msgbox with "33875" - the value of i: correct
This is really strange!!! However, it gets wierder:
I make *no* changes to the code, re-compile and run, and it GPFs before any msgboxes are shown.
I make *no* changes to the code again, re-compile and run, and the code produces the output as steps 1-4 above with no GPF.
Why does one GPF and the other not, considering all array indexes are within bounds, and all I am adding is a msgbox before the "for i" loop???
Either I'm missing something or this is a PB bug?
Alex
===================================
GLOBAL priceitems2 AS LONG
GLOBAL sltype5_lowmap() AS LONG
GLOBAL pricetime2() as LONG
GLOBAL pricedate2() as STRING
===================================
SUB MainLoop()
priceitems2 = 115691
REDIM pricetime2(priceitems2)
REDIM pricedate2(priceitems2)
' code to fill pricetime2() and pricedate2() here - tested OK
doAnalysis()
END SUB
===================================
SUB doAnalysis()
REGISTER i AS LONG
REDIM sltype5_lowmap(priceitems2)
' code to fill sltype5_lowmap(0 - priceitems2) with values here - tested OK
FOR i = 0 TO priceitems2
IF pricetime2(i) = 151600 AND pricedate2(i) = "20070605" THEN
MSGBOX("test output")
MSGBOX(STR$(priceitems2))
MSGBOX(STR$(i))
END IF
NEXT
END SUB
===================================
This produces:
1. msgbox with "test output"
2. GPF error straight after
However, if I place this line of code just before the "for i..." loop:
MSGBOX(STR$(priceitems2))
I then get the following output:
1. msgbox with 115691 (the value of priceitems2: correct)
2. msgbox with "test output"
3. msgbox with 115691 (the value of priceitems2: correct)
4. msgbox with "33875" - the value of i: correct
This is really strange!!! However, it gets wierder:
I make *no* changes to the code, re-compile and run, and it GPFs before any msgboxes are shown.
I make *no* changes to the code again, re-compile and run, and the code produces the output as steps 1-4 above with no GPF.
Why does one GPF and the other not, considering all array indexes are within bounds, and all I am adding is a msgbox before the "for i" loop???
Either I'm missing something or this is a PB bug?
Alex
Comment