Hi,
somehow I want to believe that we discussed this before, but I can't
find any reference to it and in any case I see the behavior in the
Nov-14th snapshot.
Consider this:
<hansl>
open denmark
var 2 LRM LRY --quiet # starts at 1974:3
eval $system.t1 # 2
eval obsnum(1974:3) # 3 (correct)
</hansl>
And the same with $system.t2. But note that this only happens after
'var', not after 'system'!
I've looked at the VAR_set_sample function in lib/src/var.c but saw no
obvious bug there - but also I don't even know whether at the C level
the v->t1 index is interpreted as 0-based or 1-based.
Some loosely related observations on C code chunks that I looked at
right now:
- We have this VAR_set_sample function and in lib/src/system.c there is
a system_adjust_t1t2 function which basically seems to have the same aim
(and internally calls list_adjust_sample from somewhere). Maybe some
consolidation in the medium term might be reasonable.
- In the equation_system_estimate function (also in lib/src/system.c)
there is this part (lines 1604-6):
if (err) {
goto system_bailout;
}
and then after another block there is (lines 1621...):
system_bailout:
if (!err) {
sys->smpl_t1 = dset->t1;
sys->smpl_t2 = dset->t2;
if (!(sys->flags & SYSTEM_LIML1)) {
set_as_last_model(sys, GRETL_OBJ_SYS);
}
}
return err;
Now I'm not too familiar with goto in C (wasn't goto declared taboo in
the old days?) but to me this looks as if first err must be non-zero to
jump but then there's the opposite check for a zero err. So isn't the
whole goto thing superfluous here and in the end just err is returned
(if non-zero), or what am I missing?
thanks
sven