Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You may be infinitely smaller than some things, but you're infinitely larger than others.


comp / comp.lang.tcl / can TCL a static Tcl_Obj ?

SubjectAuthor
o can TCL a static Tcl_Obj ?aotto1968

1
Subject: can TCL a static Tcl_Obj ?
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 3 Jan 2025 08:28 UTC
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (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: <vl874c$3qov2$1@dont-email.me>
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
View all headers

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.

1

rocksolid light 0.9.8
clearnet tor