Skip to content
Tcl Source Code Artifact [f7b0109757]
Login

Artifact [f7b0109757]

Artifact f7b0109757367b752e8e58cca28b3a736a388b6c:

Ticket change [f7b0109757] - New ticket [758110ffffffffff|758110ffff] <i>patch for &#39;dict info {}&#39;</i>. by hgiese on 2003-06-20 19:07:49.
D 2003-06-20T19:07:49
J assignee dkf
J cmimetype text/plain
J comment Hello\sout\sthere,\nthe\scommand\n\s\s\s\sdict\sinfo\s""\nleads\sto\sa\scrash\sin\smy\sBorland\sgenerated\sTcl\s8.5a0\s(on\nWin98).\n\nHere\sis\swhat\shappens\son\smy\smachine:\n-\sThe\sfirst\stime\saround\sin\sDictInfoCmd\sthe\sTclObj\sin\nquestion\sis\snot\sof\n\s\stype\sdictionary\sand\sso\sit\sgets\sconverted\svia\sa\scall\nto\sSetDictFromAny.\n-\sThen\sthe\svariable\s'Dict\s*dict'\sis\sproperly\ninitialised.\sInspecting\sit\n\s\sI\ssee\sthat\sits\s'table'\selement\shas\sits\selement\n'numEntries'\sset\sto\s'0'\n\s\s-\sreasonable.\n-\sBut\sthen\swithin\sTcl_HashStats\sone\scalculates\n\s\s\s\saverage\s+=\s(tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;\n\s\swith\stablePtr->numEntries\sbeing\s'0'\s->\sBOOM.\n\nI\swould\ssuggest\sthe\sfollowing\schange\sin\sfunction\n"Tcl_HashStats"\s(file\ntclHash.c):\n\nPut\sthe\sline\n\s\s\s\s\s\s\s\saverage\s+=\n(tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;\ninto\sa\sconditional\slike\n\s\s\s\s\s\s\s\s/*\n\s\s\s\s\s\s\s\s\s*\sOn\smachines\snot\ssupporting\s"automatic\sNAN\nhandling"\sor\ssuch,\swe\n\s\s\s\s\s\s\s\s\s*\sreally\sshould\stest\sfor\sthe\sdenominator\s==\s0\n\s\s\s\s\s\s\s\s\s*/\n\s\s\s\s\s\s\s\sif\s(\stablePtr->numEntries\s)\n\s\s\s\s\s\s\s\s\s\s\s\saverage\s+=\n(tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;\n\nThis\swill\sreturn\sa\svalue\sof\s0.0\sfor\sthe\saverage\s-\swhich\nis\smaybe\snot\nexactly\sright\sbut\sa\sreasonable\svalue\sfor\san\sempty\ndictionary.\n\nBest\sregards\nHelmut\sGiese\n
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter hgiese
J subsystem 15.\sDict\sObject
J title patch\sfor\s'dict\sinfo\s{}'
J type Patch
K 758110ffffffffffffffffffffffffffffffffff
U hgiese
Z 10b88d6ccd7216866f1f8255f472f6c8