/* This example program demonstrates a problem with clearing the obj result for an Interp. The first printf output the number of unicode characters in an empty result (0). The second printf should output the number of unicode characters in result abcdefgh (8). But the tclStringType internal rep of the obj result has not been cleared, and it still returns 0. */ #include int main(int argc, char* argv[]) { Tcl_Interp *interp; Tcl_FindExecutable(argv[0]); interp = Tcl_CreateInterp(); Tcl_SetResult(interp, "", TCL_STATIC); printf( "Num chars %d (0 expected)\n", Tcl_GetCharLength(Tcl_GetObjResult(interp)) ); Tcl_ResetResult(interp); Tcl_SetResult(interp, "abcdefgh", TCL_STATIC); printf( "Num chars %d (8 expected)\n", Tcl_GetCharLength(Tcl_GetObjResult(interp)) ); return 0; }