Skip to content
Tcl Source Code Artifact [daf97213ba]
Login

Artifact [daf97213ba]

Artifact daf97213ba322ec8b34d55adbf4eeffbd89c50e9:

Ticket change [daf97213ba] - Ticket [2089279fffffffff|2089279fff] <i>StringObj.3 Tcl_ObjPrintf inaccuracies</i> status still Open with 3 other changes by dgp on 2017-07-09 22:09:45.
D 2017-07-09T22:09:45.799
J icomment \r\nFor\sTcl_ObjPrintf(),\sthe\sformat\s%lld\sDOES\sNOT\sMEAN\s(long\slong\sint).\r\nIf\syou\sprogram\sas\sif\sit\sdoes,\syou\swill\sget\scrashes.\sDon't\sdo\sthat.\r\n\r\nThe\s%d\sformat\smeans\spull\san\s(int)\swhich\sis\sthen\spushed\sthrough\r\nlosslessly\sas\sa\sTcl_NewLongObj()\sto\sbe\sformatted\sby\s[format\s%d]\r\nwhich\sexpects\sto\sact\son\sa\s(long\sint).\r\n\r\n(I\sknow.\sThat's\sa\sconfusing\smess,\sbut\s[format]\swas\salready\sdesigned\r\nthat\sway\sby\sthe\stime\sI\sgot\sto\stouch\sit.)\r\n\r\nThis\sallows\sTcl_ObjPrintf()\sto\sbe\ssimilar\sto\ssprintf()\sin\swhat\sC\sprogrammers\r\nexpect\sto\spass\swhen\susing\sthe\s%d\sspecifier,\swhile\sstill\sre-using\sthe\ssame\r\nformatting\sengine\salready\sexisting\sfor\s[format].\r\n\r\nThe\s%ld\sformat\smeans\spull\sa\s(long\sint)\swhich\sis\sthen\spushed\sthrough\r\nlosslessly\sas\sa\sTcl_NewWideIntObj()\sto\sbe\sformatted\sby\s[format\s%ld]\r\nwhich\sexpects\sto\sact\son\sa\s(Tcl_WideInt).\r\n\r\nThere\sis\sno\sway\sto\spass\sa\s(long\slong\sint)\sor\sa\s(Tcl_WideInt)\sor\sa\s(size_t)\r\nargument\sto\sTcl_ObjPrintf().\s\sThere's\salways\sbeen\sa\s/*\sTODO\s*/\scomment\r\nin\sthe\scode\snoting\sthis\sincompleteness.\s\sMore\srecently\swe've\srecorded\sthe\r\nneed\sto\scorrect\sthis\sin\san\sRFE\sticket.\r\n\r\nhttps://core.tcl.tk/tcl/tktview?name=3fbaa4e23b\r\n\r\nJan\sNijtmans\shas\srelated\swork\son\sthe\sbranch\sz_modifier\r\nand\smight\shave\smore\son\sother\sbranches\sI\scannot\sfind\squickly\r\nright\snow.
J login dgp
J mimetype text/plain
K 2089279fffffffffffffffffffffffffffffffff
U dgp
Z 1e2f08bc7506de0ab4fbbc0c9753e938