Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-11-22
22:47 • Closed ticket [47d66253c9]: "lsearch -sorted -integer" on 64bit system... artifact: 64101b252d user: jan.nijtmans
22:45 • Ticket [3216010fff] lsort -integer fails with wide integers status still Clo... artifact: fc4a3c694f user: jan.nijtmans
22:43 • Closed ticket [3216010fff]. artifact: e1b5ef7019 user: jan.nijtmans
2011-03-18
04:21 • Ticket [3216010fff]: 4 changes artifact: 3c9384c19e user: dgp
04:20 • Ticket [3216010fff]: 4 changes artifact: 5f6e2d7129 user: dgp
2011-03-16
22:28 • Ticket [3216010fff]: 5 changes artifact: 0ed72e1b17 user: dgp
11:05 • New ticket [3216010fff]. artifact: b0f616059d user: petasis

lsort -integer fails with wide integers

Closed / Fixed3216010fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 4 years ago
Descriptionplain2011-03-16 11:05:13
lsort -integer fails when trying to sort a list of wide integers (i.e. a list with timestamps, like clock milliseconds returns).

I see for example in Tcl_LsortObjCmd(), in file tclCmdIL.c, line 3911 (may have changed I haven't updated to fossil):

} else if (sortMode == SORTMODE_INTEGER) {
  long a;
  if (TclGetLongFromObj(sortInfo.interp, indexPtr, &a) != TCL_OK) {
    sortInfo.resultCode = TCL_ERROR;
    goto done1;
  }
  elementArray[i].index.intValue = a;

I think that Tcl_GetWideIntFromObj() should be called if Tcl_GetLongFromObj() fails, before returning an error to the caller...
dgpplain2011-03-16 22:28:38
data_type - 360894


This is not a bug.  It's preservation of compatible output
from [lsort -integer] across minor releases.

That may be an unwise choice, but changing it is a 
feature request.
dgpplain2011-03-18 04:20:12
See http://core.tcl.tk/tcl/info/cf82eb92c8
for a checkin implementing the requested
functionality as [lsort -entier].
dgpplain2011-03-18 04:21:08
Very much un(der)tested at this point, BTW.
jan.nijtmanswiki2022-11-22 22:43:38

Fixed [here]

jan.nijtmanswiki2022-11-22 22:45:30

Dup of [47d66253c9]

Log in (anonymous is fine) to add a comment.