读源码之Tcl: 变量
风行水上 @
set 的实现
- 文件:
- generic/tclBasic.c:
static const CmdInfo builtInCmds[]
- generic/tclVar.c:
Tcl_SetObjCmd
- 概要:
Tcl_ObjGetVar2
Tcl_ObjSetVar2
- 答疑:
- Tcl_GetVar/Tcl_GetVar2 返回值是字符串,效率相对较低
- Tcl_GetVar2Ex/Tcl_ObjGetVar2 效率相对高一些
set not_exist_var
会报错,是因为用了TCL_LEAVE_ERR_MSG
选项的原因
- 遐想: