• can TCL a static Tcl_Obj ?

    From aotto1968@21:1/5 to All on Fri Jan 3 09:28:58 2025
    Hi,

    has TCL the ability to create a FULL-STATIC non delete-able Tcl_Obj

    OLD : static POINTER

    #define OtRegisterToken(tok) \
    static OT_LNG_T tok == NULL; \
    if (tok == NULL) { \
    tok = Tcl_NewStringObj(#tok,-1); \
    Tcl_IncrRefCount(tok); \
    } \

    NEW : static reference

    I would like to have a !! compiler !! initialized Tcl_Obj created OUTSIDE
    of the Tcl_Alloc??? stuff

    static Tcl_Obj tokRef = Tcl_NewStaticStringObj("my string");

    use with "&tokRef" everywhere an "Tcl_Obj*" is required.

    analysis
    --------

    OLD is always a memory leak and it is slower because it is INITIALIZED at runtime AND
    an "if" is required for every access to check if INITIALIZATION was done.

    NEW : a "never-deleted" tcl-object is allocated OUT OF Tcl_Alloc??? will massive
    increase performance.


    something to think about.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)