bug with "const" in function
by Sven Schreiber
Hi,
this is a bug that is probably triggered only in unusual circumstances,
but it happened to me in a kind-of real world function development scenario:
<hansl>
clear
function void serc (const series s) # the 'const' here is important
if exists(s)
print "to be"
else
eval typename(s)
print "or not to be"
endif
end function
open denmark
print "call 1"
serc(LRM)
print "call 2"
serc(const) # "const" is a series ID 0 in all datasets
# -> produces "null" and "or not to be", as if "s" inside the function
didn't exist
</hansl>
Notice two things: No gretl errors are thrown here, so it's not that
gretl doesn't recognize "const" as a valid series argument. Secondly,
when the function signature doesn't have the "const" arg modifier, then
it works fine.
This is with snapshot Jan 27th.
thanks
sven
7 months, 1 week