[lsort -index end-1] problem
Closed / Fixed465674ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-09-27 14:37:51
The index 'end-1' (or with any other offset from the
end) is processed by [lsort] exactly as if it was the
index 'end' without an offset. Thus
% set l {{d b c} {a c b}}
{d b c} {a c b}
% lsort $l ;# OK
{a c b} {d b c}
% lsort -index end $l ;# OK
{a c b} {d b c}
% lsort -index end-1 $l ;# WRONG WAY ROUND!
{a c b} {d b c}
The fault is because SortCompare in tclCmdIL.c always
sets 'index' to 'listLen - 1' when 'infoPtr->index' is
less than -1 instead of using the value that is
actually there (i.e. 'listLen + 1 + infoPtr->index')
dkf Closed ticket [465674ffff].
[History diff]2001-09-28 22:32:36
Log in (anonymous is fine) to add a comment.