Reference counting in UnicodeString

"Brown, Brooks" <[email protected]> Fri, 10 Dec 2004 12:35:26 -0800
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------_=_NextPart_001_01C4DEF7.C7AE533E
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

We are considering using ICU's UnicodeString as a cross platform string =
class.  (The platforms we need to support are MacOS 10.2.8 and Windows =
2000 or better.)  The UnicodeString class has many features we want, but =
I am concerned about the use of pthread_mutex_lock on non-Windows =
platforms for safe reference counting.

Is the optimization of sharing buffers for string data really worth all =
the thread synchronization that can occur?  Normally, when you copy a =
string, you modify it in the next statement, so you need to allocate a =
new buffer and copy anyway.

Should there be a compiler option to disable the behind-the-scenes =
sharing of buffers between strings?  (Excluding read only aliases, since =
those aren't reference counted.)

Brooks R. Brown
Software Engineer
Extensis, Inc.
<http://www.extensis.com/>
phone: 503.274.2020 x130
email: [email protected]

Empowering digital assets

Notice:  This communication may contain privileged or other confidential =
information.  If you are not the intended recipient, or believe that you =
have received this communication in error, please do not print, copy, =
retransmit, disseminate, or otherwise use the information.  Also, please =
indicate to the sender that you have received this email in error, and =
delete the copy you received.  Thank you.



------_=_NextPart_001_01C4DEF7.C7AE533E
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7226.0">
<TITLE>Reference counting in UnicodeString</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=3D2 FACE=3D"Arial">We are considering using ICU's =
UnicodeString as a cross platform string class.&nbsp; (The platforms we =
need to support are MacOS 10.2.8 and Windows 2000 or better.)&nbsp; The =
UnicodeString class has many features we want, but I am concerned =
about</FONT> <FONT SIZE=3D2 FACE=3D"Arial">the use of pthread_mutex_lock =
on</FONT> <FONT SIZE=3D2 FACE=3D"Arial">non-Windows platforms for safe =
reference counting.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Is the optimization of sharing buffers =
for string data really worth all the thread synchronization that can =
occur?&nbsp; Normally, when you copy a string, you modify it in the next =
statement, so you need to allocate a new buffer and copy =
anyway.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Should there be a compiler option to =
disable the behind-the-scenes sharing of buffers between strings?&nbsp; =
(Excluding read only aliases, since those aren't reference =
counted.)</FONT></P>

<P><B><FONT SIZE=3D2 FACE=3D"Arial">Brooks R. Brown</FONT></B>

<BR><FONT COLOR=3D"#999999" SIZE=3D2 FACE=3D"Arial">Software =
Engineer</FONT>

<BR><FONT COLOR=3D"#999999" SIZE=3D2 FACE=3D"Arial">Extensis, =
Inc.</FONT>

<BR><FONT COLOR=3D"#999999" SIZE=3D2 FACE=3D"Arial">&lt;<A =
HREF=3D"http://www.extensis.com/">http://www.extensis.com/</A>&gt;</FONT>=


<BR><FONT COLOR=3D"#999999" SIZE=3D2 FACE=3D"Arial">phone: 503.274.2020 =
x130</FONT>

<BR><FONT COLOR=3D"#999999" SIZE=3D2 FACE=3D"Arial">email: =
[email protected]</FONT>
</P>

<P><FONT COLOR=3D"#FF0000" SIZE=3D2 FACE=3D"Arial">Empowering digital =
assets</FONT>
</P>

<P><SPAN LANG=3D"en-us"><FONT COLOR=3D"#808080" SIZE=3D1 =
FACE=3D"Arial">Notice:&nbsp; This communication may contain privileged =
or other confidential information.&nbsp; If you are not the intended =
recipient, or believe that you have received this communication in =
error, please do not print, copy, retransmit, disseminate, or otherwise =
use the information.&nbsp; Also, please indicate to the sender that you =
have received this email in error, and delete the copy you =
received.&nbsp; Thank you.</FONT></SPAN><SPAN =
LANG=3D"en-us"></SPAN><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01C4DEF7.C7AE533E--