Am 02.11.22 um 19:18 schrieb Federico Fiorani:
Dear all,
I noticed this thing.
(gretl 2022c on Windows)
<hansl>
strings s = null
s[""]
</hansl>
<output>
? strings s = null
? s[""]
Index value 969423488 is out of bounds
Error executing script: halting
>s[""]
</output>
The number changes at every run. (maybe a memory address?)
The same problem occurs with arrays and bundles and changing the string.
As you can see it is not a serious problem but I think it's good to fix it.
Hi Fedrico,
thanks for the report.
Here on latest git version running this
<hansl>
clear
set verbose off
strings a = null
strings b = array(0)
print a b
# I think this is actually not supported
# and does not really look like a proper array access
catch a[""]
eval $error
catch b[""]
eval $error
# This is the way to go -- of course failing for an empty array
catch a[0]
eval $error
catch a[1]
eval $error
catch b[0]
eval $error
catch b[1]
eval $error
</hansl>
yields for each of those cases the error code 17.
Actually, I am surprised about a two things:
1. That this actually works: "strings a = null" I thought only "array(0)
works for initialisation.
2. That this command <a[""]> actually executes something. This, I would
argue, is not valid indexation of a string array where the index should
be a positive integer.
Artur