diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2021-04-25 20:22:05 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2021-04-25 20:22:05 (GMT) |
commit | 42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71 (patch) | |
tree | 082b18aae06a09a552884b3359810f4eb748b1d9 /doc/StringObj.3 | |
parent | 5a5cb4c044353add5cfbc502d8fdfb34d4410af6 (diff) | |
parent | 9bf722e8da25eb28ed58fe97f941f4badaa3af36 (diff) | |
download | tcl-42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71.zip tcl-42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71.tar.gz tcl-42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71.tar.bz2 |
Document our reference count management
Diffstat (limited to 'doc/StringObj.3')
-rw-r--r-- | doc/StringObj.3 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/StringObj.3 b/doc/StringObj.3 index c55f57d..22e872a 100644 --- a/doc/StringObj.3 +++ b/doc/StringObj.3 @@ -383,6 +383,33 @@ white space, then that value is ignored entirely. This white-space removal was added to make the output of the \fBconcat\fR command cleaner-looking. \fBTcl_ConcatObj\fR returns a pointer to a newly-created value whose ref count is zero. +.SH "REFERENCE COUNT MANAGEMENT" +.PP +\fBTcl_NewStringObj\fR, \fBTcl_NewUnicodeObj\fB, \fBTcl_Format\fR, +\fBTcl_ObjPrintf\fR, and \fBTcl_ConcatObj\fR always return a zero-reference +object, much like \fBTcl_NewObj\fR. +.PP +\fBTcl_GetStringFromObj\fR, \fBTcl_GetString\fR, \fBTcl_GetUnicodeFromObj\fR, +\fBTcl_GetUnicode\fR, \fBTcl_GetUniChar\fR, \fBTcl_GetCharLength\fR, and +\fBTcl_GetRange\fR all only work with an existing value; they do not +manipulate its reference count in any way. +.PP +\fBTcl_SetStringObj\fR, \fBTcl_SetUnicodeObj\fR, \fBTcl_AppendToObj\fR, +\fBTcl_AppendUnicodeToObj\fR, \fBTcl_AppendObjToObj\fR, +\fBTcl_AppendStringsToObj\fR, \fBTcl_AppendStringsToObjVA\fR, +\fBTcl_AppendLimitedToObj\fR, \fBTcl_AppendFormatToObj\fR, +\fBTcl_AppendPrintfToObj\fR, \fBTcl_SetObjLength\fR, and +\fBTcl_AttemptSetObjLength\fR and require their \fIobjPtr\fR to be an unshared +value (i.e, a reference count no more than 1) as they will modify it. +.PP +Additional arguments to the above functions (the \fIappendObjPtr\fR argument +to \fBTcl_AppendObjToObj\fR, values in the \fIobjv\fR argument to +\fBTcl_Format\fR, \fBTcl_AppendFormatToObj\fR, and \fBTcl_ConcatObj\fR) can +have any reference count, but reference counts of zero are not recommended. +.PP +\fBTcl_Format\fR and \fBTcl_AppendFormatToObj\fR may modify the interpreter +result, which involves changing the reference count of a value. + .SH "SEE ALSO" Tcl_NewObj(3), Tcl_IncrRefCount(3), Tcl_DecrRefCount(3), format(n), sprintf(3) .SH KEYWORDS |