Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-04-03
21:07 • Ticket [1685436fff] document Tcl_Preserve-ability status still Open with 2 o... artifact: 7566c1daae user: dkf
2007-03-22
04:10 • Ticket [1685436fff]: 4 changes artifact: 7fe7fe2f3a user: andreas_kupries
2007-03-21
18:22 • New ticket [1685436fff]. artifact: c258c954c4 user: dgp

document Tcl_Preserve-ability

Open1685436fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2007-03-21 18:22:48
Some public Tcl routines return
pointers that can be Tcl_Preserve()d;
for example, Tcl_CreateInterp().

Other public Tcl routines return
pointers that cannot be
Tcl_Preserve()d; for example,
Tcl_CreateNamespace().  The pointers
returned by such routines really
can't be reliably kept long-term.
Perhaps that's a bug, and more
return-able pointers need to support
Tcl_Preserve-ability.  If not, the
documentation should at least make
this distinction clear.
andreas_kupriesplain2007-03-22 04:10:58
Logged In: YES 
user_id=75003
Originator: NO

I wonder if we can snarf ideas from the linux kernel for that. IIRC they are using special macros and type magic, likely gcc specific, to give pointers additional attributes which the compiler can check. For us basically a preserve-ability tag which goes with the pointer and is checker at compile time when Tcl_Preserve is used. I should note that I have no actual idea how their stuff works in detail. Regarding it being gcc specific, it should be easy to disable that for other compilers through redefinition of whatever macros are used to implement this.

Even if we are unable or unwilling to reproduce the thing we can still use macros like

    #define PRESERVABLE(x) x

to at least add appropriate tags in the sources. No compiler checks, but at least semi-documentation in the code.
dkf Ticket [1685436fff]: 2 changes [History diff]2007-04-03 21:07:05
Log in (anonymous is fine) to add a comment.