TIP 544: Export TclGetIntForIndex()

Author:         Jan Nijtmans <[email protected]>
Author:         Fran├žois Vogel <[email protected]>
State:          Final
Type:           Project
Tcl-Version:    8.7
Vote:           Done
Created:        15-May-2019
Discussions-To: Tcl Core list
Keywords:       Tcl
Tcl-Version:    8.7
Tcl-Branch:     tip-544


This TIP proposes to export the internal function TclGetIntForIndex() as Tcl_GetIntForIndex(). The signature is:

For Tcl 9.0, all indexes have type Tcl_Size, so there the signature is:


This function can be used for extensions to parse indexes like "end-5", "12+1" ... See TIP 502: Index Value Reform and TIP 176: Add String index Values.

Use case in Tk: see Tcl-core list discussion of TIP 541: Add support for 'end' index in ttk::combobox current.


This is fully upwards compatible with Tcl 8.6.


After TIP #660 was accepted, a lot of functions changed from using size_t to ptrdiff_t parameters. In order to prevent confusion, this change has been adapted in the TIP text above as well.

Reference Implementation

Available on branch tip-544.


This document has been placed in the public domain.