Skip to content
Tcl Source Code Artifact [6461f5c50c]
Login

Artifact [6461f5c50c]

Artifact 6461f5c50cad06b6d56a963024ce17cb3fd81943b70bda12bb3cca6d85ab8f39:

Ticket change [6461f5c50c] - Ticket [e9a2715d912d8644|e9a2715d91] <i>Tcl 8.6.11: Incompatible Tcl_GetRange()</i> status still Open with 3 other changes by petasis on 2022-01-18 14:54:51.
D 2022-01-18T14:54:51.348
J icomment Dear\sJan,\r\n\r\nAt\sthe\sTcl\slevel\swe\shave\s"end".\sThe\sunofficial\s"end"\sbeing\s-1,\sis\sfor\susers\sof\sthe\sC\sAPI.\sTcl_NewStringObj,\sTcl_SetStringObj,\sTcl_AppendToObj,\sall\saccept\s-1\s(in\sfact\sany\snegative\snumber)\sas\s"till\sthe\send\sof\sthe\sstring".\r\n\r\nTcl_GetRange()\sdocumentation\sdoes\snot\spromise\sthat\s(that\sthe\slast\sparameter\scan\sbe\sa\snegative\snumber),\sbut\spassing\sa\snegative\snumber\sas\sthe\slast\sused\sto\s"work\sas\sexpected".\r\n\r\nWhat\sI\scan\sassure\syou,\sis\sthat\sas\sa\sdeveloper\sof\sseveral\sC\sextensions,\sI\shave\sused\s"-1"\sas\san\sunofficial\s"end"\sposition,\sbecause\sI\shave\sseen\sthe\scode\sof\sTcl_GetRange()\sand\scame\sto\sa\sconclusion\sthat\sit\sis\ssafe\sto\sdo\sso,\sas\sit\swas\susing\sTcl_NewStringObj()\sand\sfriends\sinternally.\r\n\r\nI\sdo\snot\ssuggest\sthat\sthis\swas\scorrect,\sor\sthat\sthe\sdocumentation\ssuggests\sso.\sI\sam\sraising\sthe\sissue\sthat\slike\sme\sthere\smay\sbe\sother\sC\sextensions\sthat\sare\susing\sthis\s"convenience",\sand\sthat\sthis\schange\sdeserves\sat\sleast\sa\smention\sof\sincompatibility\sin\sthe\srelease\snotes\sof\s8.6\s&\s8.7.\sWhat\sis\swritten\snow\s(that\serror\schecking\shas\sbeen\sadded)\sis\snot\senough.\r\n\r\nTo\smy\sview,\sand\saccording\sto\sthe\sdocumentation,\spassing\sa\snegative\svalue\sto\slast\sin\sTcl_GetString()\sis\san\serroneous\ssituation.\sIt\sshould\snever\shappen.\r\n\r\nAnd\sinput\schecking\swas\sadded\sto\sthe\sfunction.\sWhich\sleads\sto\sa\sdecision\son\swhat\sto\sdo\sif\s"last"\sis\snegative.\sGiven\sthat\sa\sNULL\scannot\sbe\sreturned\s(the\sdocumentation\spromises\sthat\sa\snew\sobject\sis\salways\sreturned),\sthe\sdecision\sis\sto\sreturn\san\sempty\sstring.\r\n\r\nI\swould\shave\staken\sa\sdifferent\sdecision,\sto\sbe\sset\sto\sthe\slast\scharacter\sof\sthe\sstring,\sbecause\sa)\sthe\slength\sof\sthe\sstring\sis\salready\sknown\sinside\sthe\sfunction\sand\sb)\sis\sless\scode\sfor\sthe\scaller\sto\sfind\sthe\slast\scharacter\sof\sthe\sstring.\r\nBut\sthats\sme\s:-)\sAt\sleast\supdate\sthe\srelease\snotes\sto\spoint\sout\sthe\spotential\sincompatibility.
J login petasis
J mimetype text/x-fossil-wiki
K e9a2715d912d86448a2ed18b2d25788cd50769b4
U petasis
Z 20e4f2900064ac25a6c465473a43911a