* Harald Oehlmann <wort…@yahoo.com>
| I am not sure when to use Tcl_BounceObj in Tcl 9.
| I only know, that there are many error issues with the abstract list.
| Is it adviceable to:
| - replace Tcl_DecrObj by Tcl_BounceObj in TCL 9?
| - still use Tcl_DecrObj in TCL 8.6?
ITYM Tcl_BounceRefCount?
Looking at the source code (Tcl9.0.4), Tcl_BounceRefCount only frees the
Tcl_Obj if the refcount is already 0.
I *think* the intention is to replace
obj = Tcl_NewObj();
Tcl_IncrRefCount(obj);
// do anything with obj that does *not* incr/decr the refcount
Tcl_DecrRefCount(obj);
by
obj = Tcl_NewObj();
// do anything with obj that does *not* incr/decr the refcount
Tcl_BounceRefCount(obj);
i.e. to avoid the Incr/Decr combo.
Note however that if "do anything with obj" modifies the refcount, it is
necessary to IncrRefCount before calling it, in which case you need to
use Tcl_DecrRefCount, not Tcl_BounceRefCount.
This means that simply replacing *any* Tcl_DecrRefCount by
Tcl_BounceRefCount is wrong, only replacing a *matching*
Tcl_IncrRefCount/Tcl_DecrRefCount by Tcl_BounceRefCount would be
(sometimes :-) ok.
My €0.01
R'
Re: #define Tcl_BounceObj Tcl_DecrObj for 8.6?
- From
- Ralf Fassel <ralf…@gmx.de>
- Organization
- A noiseless patient Spider
- Message-ID
- <ygas…@akutech.de>
- Date
- Newsgroups
- comp.lang.tcl