Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_ObjPrintf() does not accept Tcl_WideInt arguments

Closed / Fixed3fbaa4e23bfa711c4340a9a76cb7a8f71ef2f528Created 10 years agoUpdated 3 years ago
Descriptionplain2017-04-12 14:41:39
In all stable releases of Tcl since 8.5.0, there's been
a Tcl_ObjPrintf() routine, but the set of specifiers
supported includes no way to mark one of the variable
arguments as having Tcl_WideInt size.  This is noted in
a code comment.

  /* TODO: support for wide (and bignum?) arguments */

At the time, all the sprintf() calls that were suitable
for converting to the new Tcl_ObjPrintf() could be covered
with long and int arguments.

There's much more interest now in being able to pass
Tcl_Wide(U)Int arguments, so we need to define and implement
specifiers for that.

Currently Tcl_ObjPrintf() and [format] have overlapping
implementation, so that may bear on the best choices
to avoid unwise overlapping functionality exposure.
Note in particular that the "ll" modifier is already used
in the [format] engine to indicate a signed argument of
unlimited size (an mp_int).

While we're enabling Tcl_WideInt arguments, it may make
sense to deal with size_t arguments as well.

I believe strongly these specifiers should be fully portable.

This enhancement could go into 8.7 releases.
jan.nijtmanswiki2018-01-29 08:26:42

And implementation for this (and more) is proposed in TIP #476

dgpplain2018-03-15 12:45:25
This capability is now in Tcl 8.7+.
jan.nijtmans Ticket [3fbaa4e23b]: 5 changes [History diff]2024-01-31 16:43:00
Log in (anonymous is fine) to add a comment.