« il: 20 Agosto 2015, 17:46:48 »
Riporto questa discussione apparsa nella M.L.:
"
Hi:
I need a huge array of Floats, use:longNumber = 400000000 ' 400M * 8bytes = 3.2GB
Resize fArray[longNumber] ' this gives no error !!!
fArray[1] = 1000 ' this gives Out of Bounds
workaround?
--
Saludos
Ing. Martin P Cristia "
"
How does the code really look? It's hard to imagine that the codeResize fArray[longNumber]
would not raise an error as, first of all, there is no "Resize" keyword in Gambas.
Regards,
Tobi "
"
This the actual (just what's important) codePublic MatRigEst As New Float[]
Function calcular() As Integer
Dim longo As Long, longo2 As Long
' longo = 18000 * 6 * 64000 ' = -1677934592 !!!
'correct value
longo = CLong(18000) * 6 * 64000 ' = 6912000000
MatRigEst.Resize(longo) '--> no error
Debug MatRigEst.Max ' ----> -1677934592 !!!
'test
For longo2 = 0 To longo
MatRigEst[longo2] = 1000 '---> Out of bounds on first element
Next
End Function
Martin "
"
The Resize argument is a 32 bits integer, so the 64 bits integer is
truncated, and may lead to a negative 32 bits integer. Alas, there is a
bug where Resize does not raise an error if its argument is negative.
I will fix that in the next revision.
Regards,
--
Benoît Minisini "
"
Fixed in revision #7231.
Regards,
--
Benoît Minisini "
« Ultima modifica: 21 Agosto 2015, 09:29:39 da vuott »
Registrato
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »