can TCL a static Tcl_Obj ?

Liste des GroupesRevenir à cl tcl 
Sujet : can TCL a static Tcl_Obj ?
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tcl
Date : 03. Jan 2025, 09:28:58
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vl874c$3qov2$1@dont-email.me>
User-Agent : Mozilla Thunderbird
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.

Date Sujet#  Auteur
3 Jan 25 o can TCL a static Tcl_Obj ?1aotto1968

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal