Skip to content
Tcl Source Code Artifact [0b662a2833]
Login

Artifact [0b662a2833]

Artifact 0b662a2833c2136183cfd49478dd7ee8f85ec113418a66f7ef9f3421024d8fc6:

Ticket change [0b662a2833] - Ticket [3bb3bcf2da5bfe20|3bb3bcf2da] <i>Adding support for 8.7/9.0 to Tcl.pm</i> status still Open with 4 other changes by jan.nijtmans on 2022-09-06 07:12:10.
D 2022-09-06T07:12:10.032
J assignee jan.nijtmans
J icomment >\sOne\spart\sI\sam\sstill\strying\sto\sunderstand\sis\show\sto\shandle\sboolean\stypes\r\n\r\nWell,\shaving\sa\sshort\slook\sat\sthe\scode,\sthis\swon't\swork\sfor\syour\scase:\r\n\r\n<pre>\r\n\s\s\s\sTcl_NewBooleanObj(0);\r\n</pre>\r\n\r\nThe\sreason:\sthis\swill\screate\san\sinteger\sobject,\snot\sa\sboolean\sone.\sIf\syou\swant\sa\sboolean,\sdo:\r\n\r\n<pre>\r\n\s\s\s\sTcl_Obj\sboolObj\s=\sTcl_NewStringObj("true",\s);\r\n\s\s\s\sint\svalue;\r\n\s\s\s\sTcl_GetBooleanFromObj(NULL,\sboolObj,\s&value);\r\n</pre>\r\n\r\nThen\syou\scan\sbe\ssure\sthat\sboolObj->typePtr\swill\sbe\sthe\stypePtr\syou\swant.\r\n\r\nThe\sreason\sfor\sthe\schange\sis\sthat\sin\sTcl\s8.7,\sthe\sboolean\svalues\sis\sstored\sin\sinternalRep->longValue,\sin\sTcl\s9.0\sit's\sstored\sin\sinternalRep->wideValue\s(making\sit\sthe\ssame\sas\sfor\sintegers).\sExternal\scode\sshould\snot\sassume\sanything\sabout\sthe\sinternal\srepresentation,\sbut\scode\sthat\sdoes\sshould\sstill\swork\sin\sTcl\s8.7.\sUsing\s"Tcl_GetBooleanFromObj"\sshould\sdo\sthe\strick,\swithout\sassuming\sanything\sabout\sthe\sinternal\srepresentation\sof\sbooleans.\r\n\r\nHope\sthis\shelps!\sFeel\sfree\sto\sask\smore
J login jan.nijtmans
J mimetype text/x-fossil-wiki
K 3bb3bcf2da5bfe20b1ab863fd2de940bd04f4aaf
U jan.nijtmans
Z 8cea2f127d321bcc2abca3752b1c5801