TIP 494: More use of size_t/ptrdiff_t in Tcl 9

Author:         Jan Nijtmans <[email protected]>
State:          Final
Type:           Project
Vote:           Done
Created:        29-Dec-2017
Keywords:       tcl
Tcl-Version:    9.0
Tcl-Branch:     memory-API
Vote-Results:   3/0/2 accepted
Votes-For:      DKF, JN, KBK
Votes-Against:  none
Votes-Present:  JD, SL


This TIP describes the non-controversial part of the Tcl 9 changes: Make Tcl 9 ready for the 64-bit era.


int is the type of many Tcl API function arguments and return values, and also of many struct fields, but it doesn't provide sufficient room on 64-bit platforms.


On 32-bit platforms this is all 100% upwards binary compatible provided no internal API is used, since some internal structs might have incompatible but externally invisible changes.

On 64-bit platforms, those changes cause binary incompatibility. Therefore the TCL_STUB_MAGIC value needs to change, so extensions compiled using Tcl 9 headers will not load in Tcl 8 and reverse.


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. Also -DTCL_8_COMPAT is not provided any more, because it is no longer needed.


The implementation of this TIP can be found in the memory-API branch.


This document has been placed in the public domain.