|
From: Joe E. <jen...@fl...> - 2008-11-17 18:58:28
|
Andreas Leitgeb wrote: > I don't know, if Tcl_SetResult has still any value apart from > compatibility. If it has, then it might be worth a consideration > adding a variant like "Tcl_SetResultRO"(bikeshed-warning) that will > take a const char*, and a pointer to a function that in turn will > also take a const-pointer. That means, there'd also be a > typedef void (Tcl_FreeProcRO) _ANSI_ARGS_((const char *blockPtr)); > and TCL_STATIC would be eventually be typed as Tcl_FreeProcRO, so > it could be passed to the const char* taking Tcl_SetResultRO(). A read-only free procedure "void (*Tcl_FreeProcRO)(const char *blockPtr);" is oxymoronic -- "const" means "I will not modify this argument" and freeing memory counts as modification. Simpler: Tcl_SetResultRO wouldn't need or take a third 'freeProc' argument, it would always just copy the second argument just like Tcl_SetResult(..., TCL_VOLATILE), and would be typed void Tcl_SetResultRO(Tcl_Interp *, const char *); --JE |