Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: aotto1968 Newsgroups: comp.lang.tcl Subject: can TCL a static Tcl_Obj ? Date: Fri, 3 Jan 2025 09:28:58 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 03 Jan 2025 09:29:00 +0100 (CET) Injection-Info: dont-email.me; posting-host="bfcf6e41a8af79f2f3416b784180c3ca"; logging-data="4023266"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Te6y6+MzxbzSwFLwb4ogY869yCSHnAwU=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:c+GoMPh/TaF0YjNc+MuwobCGNik= Content-Language: en-US Bytes: 1862 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.