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

Login
Author:         Jan Nijtmans <[email protected]>
State:          Final
Type:           Project
Vote:           Done
Created:        29-Dec-2017
Post-History:
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

Abstract

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

Rationale

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.

Proposal

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.

Addendum

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.

Implementation

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

Copyright

This document has been placed in the public domain.