From 4d8f46acdb3620b30c180b26aec6ea51a3b404a6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 1 Feb 2024 09:08:36 +0000 Subject: Update Tcl_ObjPrintf() documentation. Make it more clear that C11 format specifiers are not supported. --- doc/StringObj.3 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/StringObj.3 b/doc/StringObj.3 index aea8d62..9ce4d16 100644 --- a/doc/StringObj.3 +++ b/doc/StringObj.3 @@ -316,9 +316,10 @@ sprintf(buf, format, ...); but with greater convenience and no need to determine \fBSOME_SUITABLE_LENGTH\fR. The formatting is done with the same core formatting engine used by \fBTcl_Format\fR. This means the set of -supported conversion specifiers is that of the \fBformat\fR command and -not that of the \fBsprintf\fR routine where the two sets differ. When a -conversion specifier passed to \fBTcl_ObjPrintf\fR includes a precision, +supported conversion specifiers is that of the \fBformat\fR command but +the behavior is as similar as possible to \fBsprintf\fR. Format specifiers +which were added by C99 (like "hh", "ll", "j", "z", "t", "L") are not supported. +When a conversion specifier passed to \fBTcl_ObjPrintf\fR includes a precision, the value is taken as a number of bytes, as \fBsprintf\fR does, and not as a number of characters, as \fBformat\fR does. This is done on the assumption that C code is more likely to know how many bytes it is -- cgit v0.12