<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments for As I See It</title>
	<link>http://www.delera.com/blog</link>
	<description>Kamen Lilov's Webspot</description>
	<pubDate>Thu, 09 Sep 2010 06:17:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>Comment on Multithreading Safety: The Dreaded Double-Check Lock by alexander.churanov</title>
		<link>http://www.delera.com/blog/?p=8#comment-5803</link>
		<pubDate>Tue, 02 Dec 2008 11:35:33 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=8#comment-5803</guid>
					<description>Stop writing articles!

You mislead people. I suggest obtaining minimal understanding of core C++ before composing stories like that. It's all your violent imagination.

Bad signs in this article:

1) &quot;...load _woInitialized in a register...&quot;
2) &quot;...they don?t know how this function is implemented internally and thus cannot be sure that _woInitialized won?t change between the two if-s...&quot;
3) &quot;...out-of-order instruction execution, coupled with delayed cache writing virtually ensures...&quot;

C++ is a high level language. This kind of thinking (I mean registers, processors and so on) damages the brain of good C++ engineer. Yes, C++ is designed to allow low-level details to be specified in a program: there is &quot;asm&quot; declaration, for example. However, a well-formed program that does not specify that details is guaranteed to behave consistently on any conforming language implementation.

The following quotes from standard should help any judicious person understand what's wrong:

all quotes are from [intro.execution]

1.9.5
&quot;A conforming implementation executing a well-formed program shall produce the same observable behavior as one of the possible execution sequences of the corresponding instance of the abstract machine with the same program and the same input... &quot;

1.9.6
&quot;The observable behavior of the abstract machine is its sequence of reads and writes to volatile data and calls to library I/O functions.&quot;

1.9.7
&quot;Accessing an object designated by a volatile lvalue (3.10), modifying an object, calling a library I/O function, or calling a function that does any of those operations are all side effects, which are changes in the state of the execution environment. Evaluation of an expression might produce side effects. At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place.&quot;

1.9.8
&quot;Once the execution of a function begins, no expressions from the calling function are evaluated until execution of the called function has completed.&quot;

1.9.11
&quot;The least requirements on a conforming implementation are:
  -- At sequence points, volatile objects are stable in the sense that previous evaluations are complete and subsequent evaluations have not yet occurred...&quot;

1.9.16
&quot;There is a sequence point at the completion of evaluation of each full-expression.&quot;

1.9.17
&quot;When calling a function (whether or not the function is inline), there is a sequence point after the evaluation of all function arguments (if any) which takes place before execution of any expressions or statements in the function body. There is also a sequence point after the copying of a returned value and before the execution of any expressions outside the function. Several contexts in C++ cause evaluation of a function call, even though no corresponding function call syntax appears in the translation unit. [Example: evaluation of a new expression invokes one or more allocation and constructor functions; see 5.3.4. For another example, invocation of a conversion function (12.3.2) can arise in contexts in which no function call syntax appears. ] The sequence points at function-entry and function-exit (as described above) are features of the function calls as evaluated, whatever the syntax of the expression that calls the function might be.&quot;

Given that bulk of standard text, can you tell what is redundant in author's solution and what is missing?</description>
		<content:encoded><![CDATA[<p>Stop writing articles!</p>
<p>You mislead people. I suggest obtaining minimal understanding of core C++ before composing stories like that. It&#8217;s all your violent imagination.</p>
<p>Bad signs in this article:</p>
<p>1) &#8220;&#8230;load _woInitialized in a register&#8230;&#8221;<br />
2) &#8220;&#8230;they don?t know how this function is implemented internally and thus cannot be sure that _woInitialized won?t change between the two if-s&#8230;&#8221;<br />
3) &#8220;&#8230;out-of-order instruction execution, coupled with delayed cache writing virtually ensures&#8230;&#8221;</p>
<p>C++ is a high level language. This kind of thinking (I mean registers, processors and so on) damages the brain of good C++ engineer. Yes, C++ is designed to allow low-level details to be specified in a program: there is &#8220;asm&#8221; declaration, for example. However, a well-formed program that does not specify that details is guaranteed to behave consistently on any conforming language implementation.</p>
<p>The following quotes from standard should help any judicious person understand what&#8217;s wrong:</p>
<p>all quotes are from [intro.execution]</p>
<p>1.9.5<br />
&#8220;A conforming implementation executing a well-formed program shall produce the same observable behavior as one of the possible execution sequences of the corresponding instance of the abstract machine with the same program and the same input&#8230; &#8221;</p>
<p>1.9.6<br />
&#8220;The observable behavior of the abstract machine is its sequence of reads and writes to volatile data and calls to library I/O functions.&#8221;</p>
<p>1.9.7<br />
&#8220;Accessing an object designated by a volatile lvalue (3.10), modifying an object, calling a library I/O function, or calling a function that does any of those operations are all side effects, which are changes in the state of the execution environment. Evaluation of an expression might produce side effects. At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place.&#8221;</p>
<p>1.9.8<br />
&#8220;Once the execution of a function begins, no expressions from the calling function are evaluated until execution of the called function has completed.&#8221;</p>
<p>1.9.11<br />
&#8220;The least requirements on a conforming implementation are:<br />
  &#8212; At sequence points, volatile objects are stable in the sense that previous evaluations are complete and subsequent evaluations have not yet occurred&#8230;&#8221;</p>
<p>1.9.16<br />
&#8220;There is a sequence point at the completion of evaluation of each full-expression.&#8221;</p>
<p>1.9.17<br />
&#8220;When calling a function (whether or not the function is inline), there is a sequence point after the evaluation of all function arguments (if any) which takes place before execution of any expressions or statements in the function body. There is also a sequence point after the copying of a returned value and before the execution of any expressions outside the function. Several contexts in C++ cause evaluation of a function call, even though no corresponding function call syntax appears in the translation unit. [Example: evaluation of a new expression invokes one or more allocation and constructor functions; see 5.3.4. For another example, invocation of a conversion function (12.3.2) can arise in contexts in which no function call syntax appears. ] The sequence points at function-entry and function-exit (as described above) are features of the function calls as evaluated, whatever the syntax of the expression that calls the function might be.&#8221;</p>
<p>Given that bulk of standard text, can you tell what is redundant in author&#8217;s solution and what is missing?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on COM, Visual C++ and #import - trickier than I thought by KamenL</title>
		<link>http://www.delera.com/blog/?p=7#comment-220</link>
		<pubDate>Wed, 08 Mar 2006 23:42:15 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=7#comment-220</guid>
					<description>Well basically you should just include this:

#import &amp;#60;c :\\windows\\system32\\hnetcfg.dll&amp;#62; tlbid(3)

...in a project of yours, and do the full compile cycle; then look for the generated .tlh and .tli files - this is whether VC will put in the generated code.

Look up the value between the tlbid() brackets with OleView.  Turns out often the 'more useful' TLB to be imported is not the first (or only) one in a DLL</description>
		<content:encoded><![CDATA[<p>Well basically you should just include this:</p>
<p>#import &lt;c :\\windows\\system32\\hnetcfg.dll&gt; tlbid(3)</p>
<p>&#8230;in a project of yours, and do the full compile cycle; then look for the generated .tlh and .tli files - this is whether VC will put in the generated code.</p>
<p>Look up the value between the tlbid() brackets with OleView.  Turns out often the &#8216;more useful&#8217; TLB to be imported is not the first (or only) one in a DLL
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on COM, Visual C++ and #import - trickier than I thought by Dave</title>
		<link>http://www.delera.com/blog/?p=7#comment-219</link>
		<pubDate>Wed, 08 Mar 2006 23:30:34 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=7#comment-219</guid>
					<description>So what was the code result of your effort ?  Any chance I could see and example ?</description>
		<content:encoded><![CDATA[<p>So what was the code result of your effort ?  Any chance I could see and example ?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on A Small Software Vendor&#8217;s Manifesto by KamenL</title>
		<link>http://www.delera.com/blog/?p=15#comment-153</link>
		<pubDate>Fri, 06 Jan 2006 18:05:24 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=15#comment-153</guid>
					<description>Well, you'd have to ask the original author about this :)

But generally speaking, there's all kinds of management.  You are more likely to find people who know their a%% from a martini drink in a smaller company.  Large corps -  well, let's just say that enlightened middle management is... extremely rare</description>
		<content:encoded><![CDATA[<p>Well, you&#8217;d have to ask the original author about this <img src='http://www.delera.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>But generally speaking, there&#8217;s all kinds of management.  You are more likely to find people who know their a%% from a martini drink in a smaller company.  Large corps -  well, let&#8217;s just say that enlightened middle management is&#8230; extremely rare
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on A Small Software Vendor&#8217;s Manifesto by Dimiter Bakardjiev</title>
		<link>http://www.delera.com/blog/?p=15#comment-152</link>
		<pubDate>Fri, 06 Jan 2006 15:49:26 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=15#comment-152</guid>
					<description>Very nice... 
What about when you are the MANAGEMENT? 
It will be very interesting if you share what's the present situation at www.delera.com

But it's confidential, isn't it?</description>
		<content:encoded><![CDATA[<p>Very nice&#8230;<br />
What about when you are the MANAGEMENT?<br />
It will be very interesting if you share what&#8217;s the present situation at <a href='http://www.delera.com' rel='nofollow'>www.delera.com</a></p>
<p>But it&#8217;s confidential, isn&#8217;t it?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by hu linning</title>
		<link>http://www.delera.com/blog/?p=10#comment-148</link>
		<pubDate>Mon, 05 Dec 2005 02:08:18 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-148</guid>
					<description>Thanks for your article.

I use rational rose approach to write software architecture document.
However, when it comes to the desgin spec. such as for a library, an application, 
rational rose did not give us any template to follow.
I wonder if you could send me some examples how to document your design spec. for your library, application etc....
Thanks a lot</description>
		<content:encoded><![CDATA[<p>Thanks for your article.</p>
<p>I use rational rose approach to write software architecture document.<br />
However, when it comes to the desgin spec. such as for a library, an application,<br />
rational rose did not give us any template to follow.<br />
I wonder if you could send me some examples how to document your design spec. for your library, application etc&#8230;.<br />
Thanks a lot
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by KamenL</title>
		<link>http://www.delera.com/blog/?p=10#comment-122</link>
		<pubDate>Fri, 14 Oct 2005 15:15:31 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-122</guid>
					<description>I don't know about Alex :) but I myself just posted a decent sample of a functional spec.

To protect the client's IP (even though this was a 2003 project), this is not the final thing, some sections have been cut out, and many name references were mangled.  Still, it should give you a very good idea on the approach we at Delera use.

http://www.delera.com/blog/share/SolutionSpec%20XXXBase.zip</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know about Alex <img src='http://www.delera.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but I myself just posted a decent sample of a functional spec.</p>
<p>To protect the client&#8217;s IP (even though this was a 2003 project), this is not the final thing, some sections have been cut out, and many name references were mangled.  Still, it should give you a very good idea on the approach we at Delera use.</p>
<p><a href='http://www.delera.com/blog/share/SolutionSpec%20XXXBase.zip' rel='nofollow'>http://www.delera.com/blog/share/SolutionSpec%20XXXBase.zip</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by Adrian</title>
		<link>http://www.delera.com/blog/?p=10#comment-121</link>
		<pubDate>Fri, 14 Oct 2005 02:38:08 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-121</guid>
					<description>Alex,  I'd appreciate some samples of functional specs.</description>
		<content:encoded><![CDATA[<p>Alex,  I&#8217;d appreciate some samples of functional specs.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Open source: are we throwing away our own lunch? by KamenL</title>
		<link>http://www.delera.com/blog/?p=9#comment-21</link>
		<pubDate>Sat, 17 Sep 2005 12:20:42 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=9#comment-21</guid>
					<description>Josh, you make an excellent point.  There is a lot of FOSS software that is useful and indeed contributes a lot to the IT field in general, while also brining enough benefit to justify the loss of development jobs involved.

A good example might be Linux; it practically destroyed the MS monopoly on operating systems, which is a Good Thing (the various Unixes predating Linux never stood a chance).  Other good examples are many developer's libraries and tools that can be done in a few man-months of work: these things bring enough benefits to justify several small companies to go out of business.

When I complain about rip-offs, I mostly consider FOSS projects that are feature-for-feature compatible with existing software produced by small and medium companies (and, oftentimes, are also, how to put it, &quot;user interface compatible&quot; with those too :)

To me, this embodies incredible short-sightedness on the part of FOSS developers.  Projects like these make it nearly impossible for small and medium ISVs to compete on the global marketplace, thus leaving the battlefields to the big guys only (the likes of IBM).  FOSS advocates often like to talk about helping the Good Guys with their software.  Well guess what?  A large percentage of the Good Guys are among those small shops which get out of business - or are never able to get started.

JBOSS in partciular is a strange case that has both pros and cons to it.  On one hand, it is most certainly a rip-off of a commercial product.  On the other hand, it attacks the provenance of large corporations - and large firms in the IT world could certainly use some attacking, given how they've shifted their strategies from &quot;50% innovation, 50% sales and market bullying&quot; to &quot;10% innovation, 90% sales and market bullying&quot; in the recent years.</description>
		<content:encoded><![CDATA[<p>Josh, you make an excellent point.  There is a lot of FOSS software that is useful and indeed contributes a lot to the IT field in general, while also brining enough benefit to justify the loss of development jobs involved.</p>
<p>A good example might be Linux; it practically destroyed the MS monopoly on operating systems, which is a Good Thing (the various Unixes predating Linux never stood a chance).  Other good examples are many developer&#8217;s libraries and tools that can be done in a few man-months of work: these things bring enough benefits to justify several small companies to go out of business.</p>
<p>When I complain about rip-offs, I mostly consider FOSS projects that are feature-for-feature compatible with existing software produced by small and medium companies (and, oftentimes, are also, how to put it, &#8220;user interface compatible&#8221; with those too <img src='http://www.delera.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To me, this embodies incredible short-sightedness on the part of FOSS developers.  Projects like these make it nearly impossible for small and medium ISVs to compete on the global marketplace, thus leaving the battlefields to the big guys only (the likes of IBM).  FOSS advocates often like to talk about helping the Good Guys with their software.  Well guess what?  A large percentage of the Good Guys are among those small shops which get out of business - or are never able to get started.</p>
<p>JBOSS in partciular is a strange case that has both pros and cons to it.  On one hand, it is most certainly a rip-off of a commercial product.  On the other hand, it attacks the provenance of large corporations - and large firms in the IT world could certainly use some attacking, given how they&#8217;ve shifted their strategies from &#8220;50% innovation, 50% sales and market bullying&#8221; to &#8220;10% innovation, 90% sales and market bullying&#8221; in the recent years.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Open source: are we throwing away our own lunch? by JoshC</title>
		<link>http://www.delera.com/blog/?p=9#comment-17</link>
		<pubDate>Fri, 16 Sep 2005 15:51:12 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=9#comment-17</guid>
					<description>Interesting article. I think one thing that FOSS-advisaries tend to forget is that the goal of FOSS is not to create money or to sustain business, but to create software. Much of the FOSS movement has been built by hobbyists and academics creating code for their own use, not for resale.

Resently, companies have begun to attempt to leverage both these existing code bases and the development model for their own purposes. Whether they succeed or fail has less to do with FOSS and more to do with how they adopt that model to the business world.

Although I am a closed-source guy (MS Developer), I of course know many people who work with FOSS software. One of my friends has been working on a project that involves moving from WebSphere to JBOSS. He told me that in initial tests, JBOSS was running some of their code nearly twice as fast as WebSphere. The hardware savings the project yields will probably be more significant than the licensing costs. To relegate JBOSS to 'generic rip-off' is probably a bit unfair.</description>
		<content:encoded><![CDATA[<p>Interesting article. I think one thing that FOSS-advisaries tend to forget is that the goal of FOSS is not to create money or to sustain business, but to create software. Much of the FOSS movement has been built by hobbyists and academics creating code for their own use, not for resale.</p>
<p>Resently, companies have begun to attempt to leverage both these existing code bases and the development model for their own purposes. Whether they succeed or fail has less to do with FOSS and more to do with how they adopt that model to the business world.</p>
<p>Although I am a closed-source guy (MS Developer), I of course know many people who work with FOSS software. One of my friends has been working on a project that involves moving from WebSphere to JBOSS. He told me that in initial tests, JBOSS was running some of their code nearly twice as fast as WebSphere. The hardware savings the project yields will probably be more significant than the licensing costs. To relegate JBOSS to &#8216;generic rip-off&#8217; is probably a bit unfair.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Open source: are we throwing away our own lunch? by KamenL</title>
		<link>http://www.delera.com/blog/?p=9#comment-15</link>
		<pubDate>Thu, 18 Aug 2005 14:19:14 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=9#comment-15</guid>
					<description>This article also has a nice view of the subject.  The interesting thing here is the guy interviewed is famous in the FOSS world.  He runs the company producing BitKeeper - a high-end source control system that is used, among other things, for managing the Linux kernel source itself.

http://www.forbes.com/technology/2005/05/26/cz_dl_0526linux.html</description>
		<content:encoded><![CDATA[<p>This article also has a nice view of the subject.  The interesting thing here is the guy interviewed is famous in the FOSS world.  He runs the company producing BitKeeper - a high-end source control system that is used, among other things, for managing the Linux kernel source itself.</p>
<p><a href='http://www.forbes.com/technology/2005/05/26/cz_dl_0526linux.html' rel='nofollow'>http://www.forbes.com/technology/2005/05/26/cz_dl_0526linux.html</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by Dan</title>
		<link>http://www.delera.com/blog/?p=10#comment-14</link>
		<pubDate>Wed, 17 Aug 2005 20:51:15 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-14</guid>
					<description>Excellent article - thank you.</description>
		<content:encoded><![CDATA[<p>Excellent article - thank you.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by KamenL</title>
		<link>http://www.delera.com/blog/?p=10#comment-13</link>
		<pubDate>Tue, 02 Aug 2005 03:43:02 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-13</guid>
					<description>Alex: very few tech stuff.  I usually place the emphasis on the user's experience workflow, and the UI Dialogs amd screes people see.

Please email me privately and I'll be happy to send you samples of some specs I did.
Overall, technical detail should correspond to what the developers could understand.  I've always had the change to work with smart developers who could not only code, but also _think_.</description>
		<content:encoded><![CDATA[<p>Alex: very few tech stuff.  I usually place the emphasis on the user&#8217;s experience workflow, and the UI Dialogs amd screes people see.</p>
<p>Please email me privately and I&#8217;ll be happy to send you samples of some specs I did.<br />
Overall, technical detail should correspond to what the developers could understand.  I&#8217;ve always had the change to work with smart developers who could not only code, but also _think_.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by Alex Bendig</title>
		<link>http://www.delera.com/blog/?p=10#comment-12</link>
		<pubDate>Tue, 02 Aug 2005 03:19:53 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-12</guid>
					<description>Interesting topic. What's the level of technical detail that you are shooting for in your functional specifications?</description>
		<content:encoded><![CDATA[<p>Interesting topic. What&#8217;s the level of technical detail that you are shooting for in your functional specifications?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by KamenL</title>
		<link>http://www.delera.com/blog/?p=10#comment-11</link>
		<pubDate>Sat, 30 Jul 2005 16:13:20 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-11</guid>
					<description>Hmm... Yes, those are usually left &quot;as is&quot; in the spec - along with clear deadlines on when they should be resolved, though.  Things such as this should always be tied to particular milestones, otherwise you just leave them hanging till the very end and then deliver... something :)</description>
		<content:encoded><![CDATA[<p>Hmm&#8230; Yes, those are usually left &#8220;as is&#8221; in the spec - along with clear deadlines on when they should be resolved, though.  Things such as this should always be tied to particular milestones, otherwise you just leave them hanging till the very end and then deliver&#8230; something <img src='http://www.delera.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Writing a functional specification by kulov</title>
		<link>http://www.delera.com/blog/?p=10#comment-10</link>
		<pubDate>Fri, 29 Jul 2005 22:26:42 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=10#comment-10</guid>
					<description>Nice article.
How do you handle open questions that neither you nor the customer have the slightest idea of answering? Do you leave them as they are in the specification?</description>
		<content:encoded><![CDATA[<p>Nice article.<br />
How do you handle open questions that neither you nor the customer have the slightest idea of answering? Do you leave them as they are in the specification?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Multithreading Safety: Reference Counting by KamenL</title>
		<link>http://www.delera.com/blog/?p=6#comment-7</link>
		<pubDate>Sun, 05 Jun 2005 17:27:33 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=6#comment-7</guid>
					<description>Someone commented by email that the Interlocked family of functions should not be mixed with critical sections / mutexes without great care.  That is absolutely correct.  I recommend reading the following post by the famous Raymond Chen:

http://blogs.msdn.com/oldnewthing/archive/2004/09/15/229915.aspx</description>
		<content:encoded><![CDATA[<p>Someone commented by email that the Interlocked family of functions should not be mixed with critical sections / mutexes without great care.  That is absolutely correct.  I recommend reading the following post by the famous Raymond Chen:</p>
<p><a href='http://blogs.msdn.com/oldnewthing/archive/2004/09/15/229915.aspx' rel='nofollow'>http://blogs.msdn.com/oldnewthing/archive/2004/09/15/229915.aspx</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Multithreading Safety: Reference Counting by KamenL</title>
		<link>http://www.delera.com/blog/?p=6#comment-6</link>
		<pubDate>Sun, 05 Jun 2005 12:04:46 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=6#comment-6</guid>
					<description>Yes, we've thought about it.  The problem is, it would make the implementation of everything else much more complex.

First, we'd have to make sure that Str and StrMT are the same in every respect - which requires 50 or so methods to be duplicated.  Many of them would be exactly the same, and the rest would differ in only a few lines.  We could also use a template class, or define something like StrBase and descend Str and StrMT from it.  But still, it is not a clean solution.

The second issue is that we'd have to define numerous &quot;cross-class&quot; helper operators.  A simple example would be the assignment operator: in addition to its current forms (Str = Str, Str = const STRCHAR*), we would have to enumerate the additional possibilities (Str = StrMT, StrMT = Str).  Multiply that by the number of operators in str.h and you will see what I mean.</description>
		<content:encoded><![CDATA[<p>Yes, we&#8217;ve thought about it.  The problem is, it would make the implementation of everything else much more complex.</p>
<p>First, we&#8217;d have to make sure that Str and StrMT are the same in every respect - which requires 50 or so methods to be duplicated.  Many of them would be exactly the same, and the rest would differ in only a few lines.  We could also use a template class, or define something like StrBase and descend Str and StrMT from it.  But still, it is not a clean solution.</p>
<p>The second issue is that we&#8217;d have to define numerous &#8220;cross-class&#8221; helper operators.  A simple example would be the assignment operator: in addition to its current forms (Str = Str, Str = const STRCHAR*), we would have to enumerate the additional possibilities (Str = StrMT, StrMT = Str).  Multiply that by the number of operators in str.h and you will see what I mean.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Multithreading Safety: Reference Counting by kulov</title>
		<link>http://www.delera.com/blog/?p=6#comment-5</link>
		<pubDate>Sun, 05 Jun 2005 09:26:40 +0000</pubDate>
		<guid>http://www.delera.com/blog/?p=6#comment-5</guid>
					<description>Wouldn’t be more intuitive to define two classes - Str and StrMT. The second one will call SetMT() by itself and the programmer will not have to call it explicitly. Also you can use some kind of auto pointer class to handle AddRef and ReleaseRef for DataBuffer. For example:

public class AutoBuffer
{
	private DataBuffer* pDataBuffer;

	AutoBuffer(DataBuffer* pBuff)
	{
		pBuff-&amp;#62;AddRef();
	}

	~AutoBuffer()
	{
		pBuff-&amp;#62;ReleaseRef();
	}
}

I am sure you have thought about it, but I am interested why you have not used this pattern.</description>
		<content:encoded><![CDATA[<p>Wouldn’t be more intuitive to define two classes - Str and StrMT. The second one will call SetMT() by itself and the programmer will not have to call it explicitly. Also you can use some kind of auto pointer class to handle AddRef and ReleaseRef for DataBuffer. For example:</p>
<p>public class AutoBuffer<br />
{<br />
	private DataBuffer* pDataBuffer;</p>
<p>	AutoBuffer(DataBuffer* pBuff)<br />
	{<br />
		pBuff-&gt;AddRef();<br />
	}</p>
<p>	~AutoBuffer()<br />
	{<br />
		pBuff-&gt;ReleaseRef();<br />
	}<br />
}</p>
<p>I am sure you have thought about it, but I am interested why you have not used this pattern.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
