<i>public routines need private #define's</i> status still Open with 4 other changes
by
.
D 2012-04-20T03:56:31
J icomment Hello,\n\nI\swould\slike\sto\spropose\sas\sthe\ssafest\ssolution\sIMHO\sfor\sTCL\sto\shave\sits\sown\sdefines.\sIn\sthe\sexample\sof\sTcl_FSAccess\sthis\scould\sbe:\n#define\sTCL_FEXISTS\s0\n#define\sTCL_FEXECUTABLE\s1\n#define\sTCL_FWRITEABLE\s2\n#define\sTCL_FREADABLE\s4\n\nThis\swould\shave\sthe\sadvantage:\n\s-\sto\sbe\ssystem-independant,\sfor\scompatibility\n\s-\sto\sprovide\sa\sclearer\sname...\n\s-\s...and\sless\sprone\sto\sclash\n\nOn\sthe\sTCL's\sinternal\simplementation,\sI\swould\ssuggest\ssomething\slike:\n\sif\s((TCL_FEXISTS\s==\sF_OK)\s&&\s(TCL_FREADABLE\s==\sR_OK)\s&&\s(...))\s{\n\s\stype_for_syscall\s=\stype_arg\s&\s(TCL_FREADABLE\s|\sTCL_FWRITEABLE\s|\s...);\n\s\s//\sto\savoid\spotential\smisused\sbits\n}\selse\s{\n\s\stype_for_syscall\s=\s0;\n\s\sif\s(type_arg\s&\sTCL_FREADABLE)\stype_for_syscal\s|=\sR_OK;\n\s...\n}\n\nLeting,\sof\scourse,\sthe\scompiler\soptimise\sthe\sfirst\sif,\sso\swe'd\shave:\n\s-\sa\scode\sthat\sis\sportable\n\s-\sa\scode\spotentially\soptimised\sif\sthe\sdefines\smatches\sthe\ssys\sdefs\n\nOn\sa\sside\snote,\sI'd\slike\sto\sremind\sthe\snote\sI\sraised\sin\s#3517838\sabout\sdescribing\sF_OK/TCL_FEXISTS\sas\sbeing\sactually\s0,\sto\sprevent\spotential\sdevelopper's\sheadache\swith\stests\slike\s"if\s(type\s&\sTCL_FEXISTS)".\nTalking\sabout\sthis\sbug,\sI\salso\stake\sthe\sopportunity\sto\sthank\syou\sfor\sthe\shelp.\n\nRegards,\nChristophe.\n
J login lobotomy642
J mimetype text/plain
J username lobotomy642
K 945570ffffffffffffffffffffffffffffffffff
U lobotomy642
Z bc04bf8de16cf445b2f7fea327f692a5