<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.3.3" --><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
	<title>Comments for COdE fr3@K</title>
	<link>http://fsfoundry.org/codefreak</link>
	<description>Weblog of a lively geek.</description>
	<pubDate>Thu, 06 Nov 2008 18:56:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/commentsforcodefreak" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Comment on C++0x 風暴, 即將來襲 by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4730</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Mon, 03 Nov 2008 04:07:05 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4730</guid>
		<description>Thanks for the heads up.

Though I suspect the original form (without explicitly mentioning of &lt;code&gt;string&lt;/code&gt; when creating the tmp string object) should work as well, I've modified my example code snip, just to be sure.

Would you post the entire error message regarding the ambiguous call? I would like to see which functions VC10 selected as viable candidates.</description>
		<content:encoded><![CDATA[<p>Thanks for the heads up.</p>
<p>Though I suspect the original form (without explicitly mentioning of <code>string</code> when creating the tmp string object) should work as well, I&#8217;ve modified my example code snip, just to be sure.</p>
<p>Would you post the entire error message regarding the ambiguous call? I would like to see which functions VC10 selected as viable candidates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on C++0x 風暴, 即將來襲 by icek</title>
		<link>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4728</link>
		<dc:creator>icek</dc:creator>
		<pubDate>Sun, 02 Nov 2008 21:27:41 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4728</guid>
		<description>&lt;code&gt; strings.push_back(“bar”);&lt;/code&gt;
BTW, this isn't work, because "'std::vector::push_back' : ambiguous call to overloaded function". May be in vc10 only, but...

Fortunately, this code works fine:
&lt;code&gt;strings.push_back(string("hi"));&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code> strings.push_back(“bar”);</code><br />
BTW, this isn&#8217;t work, because &#8220;&#8217;std::vector::push_back&#8217; : ambiguous call to overloaded function&#8221;. May be in vc10 only, but&#8230;</p>
<p>Fortunately, this code works fine:<br />
<code>strings.push_back(string("hi"));</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on C++0x 風暴, 即將來襲 by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4727</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Sat, 01 Nov 2008 16:34:33 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4727</guid>
		<description>Hi icek,

Sounds like we have a chance to support rvalue-references in NTL's containers, even before Dinkumware's implementation.

Cool~</description>
		<content:encoded><![CDATA[<p>Hi icek,</p>
<p>Sounds like we have a chance to support rvalue-references in NTL&#8217;s containers, even before Dinkumware&#8217;s implementation.</p>
<p>Cool~</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on C++0x 風暴, 即將來襲 by icek</title>
		<link>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4726</link>
		<dc:creator>icek</dc:creator>
		<pubDate>Fri, 31 Oct 2008 02:21:36 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/29/incoming-strom-cpp0x/#comment-4726</guid>
		<description>&lt;code&gt;strings.push_back(“bar”);&lt;/code&gt;
It is not work today (Compiler Version 16.00.11001.01 for 80x86), because dinkumware's std::vector doesn't have void push_back(T&amp;&amp; x) :)</description>
		<content:encoded><![CDATA[<p><code>strings.push_back(“bar”);</code><br />
It is not work today (Compiler Version 16.00.11001.01 for 80&#215;86), because dinkumware&#8217;s std::vector doesn&#8217;t have void push_back(T&amp;&amp; x) <img src='http://fsfoundry.org/codefreak/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 搞 FOSS 為哪樁? by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/10/13/foss-contrib-for-what/#comment-4713</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Sun, 19 Oct 2008 13:41:59 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/13/foss-contrib-for-what/#comment-4713</guid>
		<description>兩位,

Happy hacking!

yuxio,

那篇文章與其相關的討論串挺有意思吧~

但我與你的看法不同. 我認為工作上的專案或許更容易被中斷. 以我個人的經驗來說, 或許是由於不夠遠視, 迫於 (來自股東的) 短期獲利壓力等因素, 台灣的軟體公司更不容易堅持高技術難度 (也因此對 engineer 來說, 通常為有趣) 的 project.

反而很少聽說掛掉的 FOSS project 案例. FOSS project 的狀態差異通常是在於受不受歡迎, user 多寡, 是否 actively developed/maintained 等等. 一個由於 contributor 沒空維護的 FOSS project 比較像是在冬眠, 隨時可因為 contributor 又有時間了就 (至少在 contributor 眼裏) 又活過來了. Contributor 沒興趣了可能會是最慘的狀況了吧.</description>
		<content:encoded><![CDATA[<p>兩位,</p>
<p>Happy hacking!</p>
<p>yuxio,</p>
<p>那篇文章與其相關的討論串挺有意思吧~</p>
<p>但我與你的看法不同. 我認為工作上的專案或許更容易被中斷. 以我個人的經驗來說, 或許是由於不夠遠視, 迫於 (來自股東的) 短期獲利壓力等因素, 台灣的軟體公司更不容易堅持高技術難度 (也因此對 engineer 來說, 通常為有趣) 的 project.</p>
<p>反而很少聽說掛掉的 FOSS project 案例. FOSS project 的狀態差異通常是在於受不受歡迎, user 多寡, 是否 actively developed/maintained 等等. 一個由於 contributor 沒空維護的 FOSS project 比較像是在冬眠, 隨時可因為 contributor 又有時間了就 (至少在 contributor 眼裏) 又活過來了. Contributor 沒興趣了可能會是最慘的狀況了吧.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 搞 FOSS 為哪樁? by yuxio</title>
		<link>http://fsfoundry.org/codefreak/2008/10/13/foss-contrib-for-what/#comment-4711</link>
		<dc:creator>yuxio</dc:creator>
		<pubDate>Fri, 17 Oct 2008 05:27:23 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/13/foss-contrib-for-what/#comment-4711</guid>
		<description>對你這篇文章感到心有戚戚焉啊～

BTW, 我去看了 slashdot 的那篇文章，真的是非常兩難的問題。接受了，也許就衣食無虞，又可以做自己喜歡的案子（開戰鬥機 :P )，但是接受對方公司的條件後，就代表自己就算下班之後研究、設計戰鬥機的貢獻，也不能對外對社群發佈。

靠著興趣而開發的專案，也許哪天會因為現實問題而中斷；現在有公司付錢讓你做自己有興趣想做的東西，雖然專案不會中斷，但成果卻屬公司所有，即使在下班之後也不能做相關領域的貢獻....也難怪這篇會引起那麼多的迴響。</description>
		<content:encoded><![CDATA[<p>對你這篇文章感到心有戚戚焉啊～</p>
<p>BTW, 我去看了 slashdot 的那篇文章，真的是非常兩難的問題。接受了，也許就衣食無虞，又可以做自己喜歡的案子（開戰鬥機 <img src='http://fsfoundry.org/codefreak/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )，但是接受對方公司的條件後，就代表自己就算下班之後研究、設計戰鬥機的貢獻，也不能對外對社群發佈。</p>
<p>靠著興趣而開發的專案，也許哪天會因為現實問題而中斷；現在有公司付錢讓你做自己有興趣想做的東西，雖然專案不會中斷，但成果卻屬公司所有，即使在下班之後也不能做相關領域的貢獻&#8230;.也難怪這篇會引起那麼多的迴響。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 搞 FOSS 為哪樁? by 半路</title>
		<link>http://fsfoundry.org/codefreak/2008/10/13/foss-contrib-for-what/#comment-4709</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Wed, 15 Oct 2008 06:55:16 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/13/foss-contrib-for-what/#comment-4709</guid>
		<description>寫得好，我也經常有相同感觸。
開飛機的比喻真是貼切無比。</description>
		<content:encoded><![CDATA[<p>寫得好，我也經常有相同感觸。<br />
開飛機的比喻真是貼切無比。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Containers with Stateful Allocator, a Bug in C++98 by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4703</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Sat, 11 Oct 2008 15:05:07 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4703</guid>
		<description>Hi Ziyu,

It seems to me, in the context of your comments regarding this post, the word "allocator" is not related to STL allocator. You just meant a software module which enables &lt;a href="http://en.wikipedia.org/wiki/Dynamic_memory_allocation" rel="nofollow"&gt;dynamic memory allocation&lt;/a&gt; in a more generic sense.

If so, I think I've managed to understand your comment better this time. :)

In this reply, I am going to use the word "allocator" the same way as you do, unless otherwise specified.

&lt;blockquote&gt;In my works , allocator is used for make sure memory can be safely free and don’t need to call destructor on objects and help performance for huge number of objects...&lt;/blockquote&gt;

IMO, this is a customized garbage collection scheme/protocol for this special purpose non-global (process wise) allocator, performance gain is one of its side effects.

&lt;blockquote&gt;Therefore, I will carefully design all classes won’t mess up when
we we destory allocator. So, if we use objects along with particular
allocator, these objects will just like living in isolated world.&lt;/blockquote&gt;

I gotcha. Your schema works similar to allocating memory blocks in a process, without deallocation. However, they would be deallocated when the process exists anyway.

Your schema is basically the same as &lt;a href="http://www.boost.org/doc/libs/1_35_0/libs/pool/doc/interfaces/pool.html" rel="nofollow"&gt;boost::pool&lt;/a&gt; (non-typed) and &lt;a href="http://www.boost.org/doc/libs/1_35_0/libs/pool/doc/interfaces/object_pool.html" rel="nofollow"&gt;boost::object_pool&lt;/a&gt; (typed).

Correct?

&lt;blockquote&gt;If you can’t isolate them, you shouldn’t use allocator.
I don’t believe there is any kind allocator will allow you swap managed memory block.&lt;/blockquote&gt;

I disagree. This is just a schema one (in this case, you) chooses to use in his/her application. Though it may be one of the better schema for that particular application.

However, one may adopt a different schema (say) so that an allocator is never destroyed earlier than any reference to its managed memory blocks, for example, &lt;a href="http://www.boost.org/doc/libs/1_35_0/libs/pool/doc/interfaces/singleton_pool.html" rel="nofollow"&gt;boost::singleton_pool&lt;/a&gt;. This would've surrendered the isolation you deemed mandatory pointless, in a different application where a different choice was made.

Always keep this in mind, there is no one schema that works best for all applications.

&lt;blockquote&gt;STDCXX is good enough to protect you do stupid things, in my opinion.&lt;/blockquote&gt;

Okay, back to STL allocators. Yes, functionality wise, STDCXX works. (Was it your intention to not mention DINKUMWARE/MSVC? The behaviors of the two implementations are effectively the same in this regard.) In fact, according to the Standard, all implementations I examined worked (functionality wise) and are compliant to the Standard. (that is if we don't take the non-inheritable allocator thing into account) But this post is not about functionality nor Standard compliance. Rather, it's about  &lt;strong&gt;stateful STL allocator semantics&lt;/strong&gt; and &lt;strong&gt;assumptions programmers make about STL containers&lt;/strong&gt; (in respect of swapping, mostly). For example, one may write a function template that needs to swap the content of two containers in the middle of things it does:

&lt;pre&gt;template &lt;class StlContainer&gt;
void foo(StlContainer&amp; container)
{
  // do something meaningful...

  // This container, `another_container`, uses default
  // constructed instance of type StlContainer::allocator_type.
  StlContainer another_container;

  // However, since the parameter `container` is passed in, it
  // could very well use an user specified instance of type
  // StlContainer::allocator_type.
  swap(another_container, container);

  // do other meaningful things...
}&lt;/pre&gt;

One would (I certainly would before I wrote the allocator library mentioned earlier in this post) most likely to assume the swapping is always trivial (say swapping a few pointers) and no-throw. When such assumption is more than programming convenience, but an assertion he/she relies on for a particular application, he/she may be in very deep trouble.

Because there is nothing stopping users of this function passing a STL container which uses a stateful allocator. BTW, IMO, such usages are very &lt;strong&gt;valid and reasonable&lt;/strong&gt;, unless it is documented otherwise. To make things worse, this is not an issue caused by the STL implementation he/she uses, the problem roots in the Standard. He/she can't just file a bug report and expect someone would fix the implementation.

&lt;blockquote&gt;BTW, I don’t belive my C++ is better than you.&lt;/blockquote&gt;

This I wouldn't know and is a non-matter in this discussion.

Anyhow, I know no shame so I took it as a compliment. Thanks.

&lt;blockquote&gt;I just feel strange you try to figure out what will happen
when STL objects works with mixed allocator.
I my experience, even not STL. this is not allowed.&lt;/blockquote&gt;

Yes, it is allowed, at least in the context of STL containers. It is a &lt;strong&gt;real problem&lt;/strong&gt;. Please visit the first two links in the reference section of this post:
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#431" rel="nofollow"&gt;Issue 431, C++ Standard Library Active Issues List&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1599.html" rel="nofollow"&gt;n1599, C++ Standards Committee Papers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

As you can see, this issue has been noted and documented more than once, by the C++ Standard Committee. I am not the first person to talk about this issue, I just happen to re-discovered it on my own.

Cheers~

PS. this has gotta be one of the longest replies I've ever written.</description>
		<content:encoded><![CDATA[<p>Hi Ziyu,</p>
<p>It seems to me, in the context of your comments regarding this post, the word &#8220;allocator&#8221; is not related to STL allocator. You just meant a software module which enables <a href="http://en.wikipedia.org/wiki/Dynamic_memory_allocation" rel="nofollow">dynamic memory allocation</a> in a more generic sense.</p>
<p>If so, I think I&#8217;ve managed to understand your comment better this time. <img src='http://fsfoundry.org/codefreak/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In this reply, I am going to use the word &#8220;allocator&#8221; the same way as you do, unless otherwise specified.</p>
<blockquote><p>In my works , allocator is used for make sure memory can be safely free and don’t need to call destructor on objects and help performance for huge number of objects&#8230;</p></blockquote>
<p>IMO, this is a customized garbage collection scheme/protocol for this special purpose non-global (process wise) allocator, performance gain is one of its side effects.</p>
<blockquote><p>Therefore, I will carefully design all classes won’t mess up when<br />
we we destory allocator. So, if we use objects along with particular<br />
allocator, these objects will just like living in isolated world.</p></blockquote>
<p>I gotcha. Your schema works similar to allocating memory blocks in a process, without deallocation. However, they would be deallocated when the process exists anyway.</p>
<p>Your schema is basically the same as <a href="http://www.boost.org/doc/libs/1_35_0/libs/pool/doc/interfaces/pool.html" rel="nofollow">boost::pool</a> (non-typed) and <a href="http://www.boost.org/doc/libs/1_35_0/libs/pool/doc/interfaces/object_pool.html" rel="nofollow">boost::object_pool</a> (typed).</p>
<p>Correct?</p>
<blockquote><p>If you can’t isolate them, you shouldn’t use allocator.<br />
I don’t believe there is any kind allocator will allow you swap managed memory block.</p></blockquote>
<p>I disagree. This is just a schema one (in this case, you) chooses to use in his/her application. Though it may be one of the better schema for that particular application.</p>
<p>However, one may adopt a different schema (say) so that an allocator is never destroyed earlier than any reference to its managed memory blocks, for example, <a href="http://www.boost.org/doc/libs/1_35_0/libs/pool/doc/interfaces/singleton_pool.html" rel="nofollow">boost::singleton_pool</a>. This would&#8217;ve surrendered the isolation you deemed mandatory pointless, in a different application where a different choice was made.</p>
<p>Always keep this in mind, there is no one schema that works best for all applications.</p>
<blockquote><p>STDCXX is good enough to protect you do stupid things, in my opinion.</p></blockquote>
<p>Okay, back to STL allocators. Yes, functionality wise, STDCXX works. (Was it your intention to not mention DINKUMWARE/MSVC? The behaviors of the two implementations are effectively the same in this regard.) In fact, according to the Standard, all implementations I examined worked (functionality wise) and are compliant to the Standard. (that is if we don&#8217;t take the non-inheritable allocator thing into account) But this post is not about functionality nor Standard compliance. Rather, it&#8217;s about  <strong>stateful STL allocator semantics</strong> and <strong>assumptions programmers make about STL containers</strong> (in respect of swapping, mostly). For example, one may write a function template that needs to swap the content of two containers in the middle of things it does:</p>
<pre>template &lt;class StlContainer&gt;
void foo(StlContainer&#038; container)
{
  // do something meaningful...

  // This container, `another_container`, uses default
  // constructed instance of type StlContainer::allocator_type.
  StlContainer another_container;

  // However, since the parameter `container` is passed in, it
  // could very well use an user specified instance of type
  // StlContainer::allocator_type.
  swap(another_container, container);

  // do other meaningful things...
}</pre>
<p>One would (I certainly would before I wrote the allocator library mentioned earlier in this post) most likely to assume the swapping is always trivial (say swapping a few pointers) and no-throw. When such assumption is more than programming convenience, but an assertion he/she relies on for a particular application, he/she may be in very deep trouble.</p>
<p>Because there is nothing stopping users of this function passing a STL container which uses a stateful allocator. BTW, IMO, such usages are very <strong>valid and reasonable</strong>, unless it is documented otherwise. To make things worse, this is not an issue caused by the STL implementation he/she uses, the problem roots in the Standard. He/she can&#8217;t just file a bug report and expect someone would fix the implementation.</p>
<blockquote><p>BTW, I don’t belive my C++ is better than you.</p></blockquote>
<p>This I wouldn&#8217;t know and is a non-matter in this discussion.</p>
<p>Anyhow, I know no shame so I took it as a compliment. Thanks.</p>
<blockquote><p>I just feel strange you try to figure out what will happen<br />
when STL objects works with mixed allocator.<br />
I my experience, even not STL. this is not allowed.</p></blockquote>
<p>Yes, it is allowed, at least in the context of STL containers. It is a <strong>real problem</strong>. Please visit the first two links in the reference section of this post:</p>
<ul>
<li><a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#431" rel="nofollow">Issue 431, C++ Standard Library Active Issues List</a></li>
<li><a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1599.html" rel="nofollow">n1599, C++ Standards Committee Papers</a></li>
</ul>
<p>As you can see, this issue has been noted and documented more than once, by the C++ Standard Committee. I am not the first person to talk about this issue, I just happen to re-discovered it on my own.</p>
<p>Cheers~</p>
<p>PS. this has gotta be one of the longest replies I&#8217;ve ever written.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Containers with Stateful Allocator, a Bug in C++98 by ziyu_huang</title>
		<link>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4701</link>
		<dc:creator>ziyu_huang</dc:creator>
		<pubDate>Fri, 10 Oct 2008 12:29:24 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4701</guid>
		<description>BTW, I don't belive my C++ is better than you.
I just feel strange you try to figure out what will happen
when STL objects works with mixed allocator.
I my experience, even not STL. this is not allowed.</description>
		<content:encoded><![CDATA[<p>BTW, I don&#8217;t belive my C++ is better than you.<br />
I just feel strange you try to figure out what will happen<br />
when STL objects works with mixed allocator.<br />
I my experience, even not STL. this is not allowed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Containers with Stateful Allocator, a Bug in C++98 by ziyu_huang</title>
		<link>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4700</link>
		<dc:creator>ziyu_huang</dc:creator>
		<pubDate>Fri, 10 Oct 2008 12:18:18 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4700</guid>
		<description>In my works , allocator is used for make sure memory can be safely free
and don't need to call destructor on objects and help performance for huge
number of objects. So, I my works, it is almost for performance.

Therefore, I will carefully design all classes won't mess up when 
we we destory allocator. So, if we use objects along with particular
allocator, these objects will just like living in isolated world.

If you can't isolate them, you shouldn't use allocator.
I don't believe there is any kind allocator will allow you swap managed memory
block.

STDCXX is good enough to protect you do stupid things, in my opinion.</description>
		<content:encoded><![CDATA[<p>In my works , allocator is used for make sure memory can be safely free<br />
and don&#8217;t need to call destructor on objects and help performance for huge<br />
number of objects. So, I my works, it is almost for performance.</p>
<p>Therefore, I will carefully design all classes won&#8217;t mess up when<br />
we we destory allocator. So, if we use objects along with particular<br />
allocator, these objects will just like living in isolated world.</p>
<p>If you can&#8217;t isolate them, you shouldn&#8217;t use allocator.<br />
I don&#8217;t believe there is any kind allocator will allow you swap managed memory<br />
block.</p>
<p>STDCXX is good enough to protect you do stupid things, in my opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Containers with Stateful Allocator, a Bug in C++98 by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4699</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Thu, 09 Oct 2008 10:48:51 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4699</guid>
		<description>Hi Ziyu,

For many C++ programmers, this post is just flat boring, most of them probably couldn't care less about the issues it attempted to highlight. I am thrilled by the fact that there are real people who read this post.

However, I failed to understand some of your comment in a sensible way. My guess is that, it would be easier if we could communicate in Chinese, regarding this post. :) (But I could be wrong :P)

&lt;blockquote&gt;Allocator per instance is used for performance generally.&lt;/blockquote&gt;
Yes and No.

我想你的原意與 STL-style allocator 無關, 指的是特別的 custom allocator.

我舉個例, 除了 general purpose memory allocator (e.g. C 的 malloc, C++ 的 ::operator new), 最常見的 memory allocator 大概就是 memory pool (e.g. boost::singleton_pool). Memory pool 會被使用的原因很多, 當然 runtime performance 可以是原因, 也有其他與 runtime performance 無關的重要因素會讓 programmer 選擇 memory pool. 例如為了確保 memory allocation 不會失敗 (e.g. pre-allocation), 或是限制某 module 使用 memory 的上限 and/or 簡化 garbage colloction (e.g. resource pool).

&lt;blockquote&gt;The issues you raise is not real problem you gonna happened, unless you don’t know how the whole idea works.&lt;/blockquote&gt;
這句話前半句的意思是說 "這不是個有意義的問題, 因為你不會遇到這個狀況" 嗎???

事實上我就是遇到了這個狀況. 雖然鑽研 STL source code 常是有趣的事情, 但這次我是在對 container 做 swap 時觀察到預期之外的行為才發現這個問題的.

後半句好像是說 "除非你不完全清楚這玩意到底是怎麼運作的".

小弟應該算是稍微清楚的...

&lt;blockquote&gt;If you concern too much , nothing will be done before everything is perfect.&lt;/blockquote&gt;
我猜這句話的意思是 "想太多會幹不了事, 沒有東西是完美的".

的確, 我是個想&lt;del&gt;很&lt;/del&gt;&lt;ins&gt;太&lt;/ins&gt;多的人 :P 不過老闆還沒把我 fire 掉, 還是有在幹事啦~~

&lt;a href="http://fsfoundry.org/codefreak/2008/04/13/cpp-is-not-privileged-to-language-lawyers/#ps" rel="nofollow"&gt;C++ 絕對不是最好或是 perfect&lt;/a&gt;. 我也不敢期盼任何事物是完美的. (除了老婆之外 :P) 但請你考慮一下我的角度, 我 (自認) 是個熱愛 C++ 的重度使用者, 如果你也看了我其他的文字的話可能會注意到, 雖然在評論時我會試著客觀, 但在模糊地帶我只會偏心說 C++ 的好話, 幹樵都是樵別人. 在我跳出來談 C++ 語言/library/standard 的缺點時, 雖不見得是天大的事情, 卻 (IMO) 很可能是值得探討/注意的 issue.

&lt;blockquote&gt;It’s not reasonable to exchange data between two same class object by different allocator. It won’t and should’nt be happened in real work. Unless the coder is idiot.&lt;/blockquote&gt;

很遺憾, 我對這段的理解比較肯定. 這個笨蛋就是我 XD. 不論我同不同意這個結論, 希望 Ziyu 可以對前題 - 為什麼這在真實世界不會發生 - 做進一步的說明.

BTW, I didn't feel offended by your comment. 但我確實希望能夠了解你的回應中我沒能夠清楚理解的部份.

Cheers~</description>
		<content:encoded><![CDATA[<p>Hi Ziyu,</p>
<p>For many C++ programmers, this post is just flat boring, most of them probably couldn&#8217;t care less about the issues it attempted to highlight. I am thrilled by the fact that there are real people who read this post.</p>
<p>However, I failed to understand some of your comment in a sensible way. My guess is that, it would be easier if we could communicate in Chinese, regarding this post. <img src='http://fsfoundry.org/codefreak/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> (But I could be wrong :P)</p>
<blockquote><p>Allocator per instance is used for performance generally.</p></blockquote>
<p>Yes and No.</p>
<p>我想你的原意與 STL-style allocator 無關, 指的是特別的 custom allocator.</p>
<p>我舉個例, 除了 general purpose memory allocator (e.g. C 的 malloc, C++ 的 ::operator new), 最常見的 memory allocator 大概就是 memory pool (e.g. boost::singleton_pool). Memory pool 會被使用的原因很多, 當然 runtime performance 可以是原因, 也有其他與 runtime performance 無關的重要因素會讓 programmer 選擇 memory pool. 例如為了確保 memory allocation 不會失敗 (e.g. pre-allocation), 或是限制某 module 使用 memory 的上限 and/or 簡化 garbage colloction (e.g. resource pool).</p>
<blockquote><p>The issues you raise is not real problem you gonna happened, unless you don’t know how the whole idea works.</p></blockquote>
<p>這句話前半句的意思是說 &#8220;這不是個有意義的問題, 因為你不會遇到這個狀況&#8221; 嗎???</p>
<p>事實上我就是遇到了這個狀況. 雖然鑽研 STL source code 常是有趣的事情, 但這次我是在對 container 做 swap 時觀察到預期之外的行為才發現這個問題的.</p>
<p>後半句好像是說 &#8220;除非你不完全清楚這玩意到底是怎麼運作的&#8221;.</p>
<p>小弟應該算是稍微清楚的&#8230;</p>
<blockquote><p>If you concern too much , nothing will be done before everything is perfect.</p></blockquote>
<p>我猜這句話的意思是 &#8220;想太多會幹不了事, 沒有東西是完美的&#8221;.</p>
<p>的確, 我是個想<del>很</del><ins>太</ins>多的人 <img src='http://fsfoundry.org/codefreak/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> 不過老闆還沒把我 fire 掉, 還是有在幹事啦~~</p>
<p><a href="http://fsfoundry.org/codefreak/2008/04/13/cpp-is-not-privileged-to-language-lawyers/#ps" rel="nofollow">C++ 絕對不是最好或是 perfect</a>. 我也不敢期盼任何事物是完美的. (除了老婆之外 :P) 但請你考慮一下我的角度, 我 (自認) 是個熱愛 C++ 的重度使用者, 如果你也看了我其他的文字的話可能會注意到, 雖然在評論時我會試著客觀, 但在模糊地帶我只會偏心說 C++ 的好話, 幹樵都是樵別人. 在我跳出來談 C++ 語言/library/standard 的缺點時, 雖不見得是天大的事情, 卻 (IMO) 很可能是值得探討/注意的 issue.</p>
<blockquote><p>It’s not reasonable to exchange data between two same class object by different allocator. It won’t and should’nt be happened in real work. Unless the coder is idiot.</p></blockquote>
<p>很遺憾, 我對這段的理解比較肯定. 這個笨蛋就是我 XD. 不論我同不同意這個結論, 希望 Ziyu 可以對前題 - 為什麼這在真實世界不會發生 - 做進一步的說明.</p>
<p>BTW, I didn&#8217;t feel offended by your comment. 但我確實希望能夠了解你的回應中我沒能夠清楚理解的部份.</p>
<p>Cheers~</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Stroustrup &amp; Sutter on C++ by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4698</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Thu, 09 Oct 2008 05:59:59 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4698</guid>
		<description>Thanks Sam. Unfortunately, I don't have Silverlight on my primary workstation, will watch it during the coming long weekend using a VM which runs Windows.

Happy holidays~</description>
		<content:encoded><![CDATA[<p>Thanks Sam. Unfortunately, I don&#8217;t have Silverlight on my primary workstation, will watch it during the coming long weekend using a VM which runs Windows.</p>
<p>Happy holidays~</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Stroustrup &amp; Sutter on C++ by sam</title>
		<link>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4697</link>
		<dc:creator>sam</dc:creator>
		<pubDate>Thu, 09 Oct 2008 02:50:48 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4697</guid>
		<description>F.Y.I. Here is a video from Channel 9 talk about Parallelism for C++ (from Microsoft)

http://channel9.msdn.com/posts/Charles/The-Concurrency-Runtime-Fine-Grained-Parallelism-for-C/</description>
		<content:encoded><![CDATA[<p>F.Y.I. Here is a video from Channel 9 talk about Parallelism for C++ (from Microsoft)</p>
<p><a href="http://channel9.msdn.com/posts/Charles/The-Concurrency-Runtime-Fine-Grained-Parallelism-for-C/" rel="nofollow">http://channel9.msdn.com/posts/Charles/The-Concurrency-Runtime-Fine-Grained-Parallelism-for-C/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Containers with Stateful Allocator, a Bug in C++98 by Ziyu Huang</title>
		<link>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4696</link>
		<dc:creator>Ziyu Huang</dc:creator>
		<pubDate>Wed, 08 Oct 2008 23:11:33 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/06/08/containers-with-stateful-allocator-a-bug-in-cpp98/#comment-4696</guid>
		<description>Allocator per instance is used for performance generally.
The issues you raise is not real problem you gonna happened, unless
you don't know how the whole idea works.

If you concern too much , nothing will be done before everything is perfect.

It's not reasonable to exchange data between two same class object by different
allocator. It won't and should'nt be happened in real work. Unless the coder is idiot.</description>
		<content:encoded><![CDATA[<p>Allocator per instance is used for performance generally.<br />
The issues you raise is not real problem you gonna happened, unless<br />
you don&#8217;t know how the whole idea works.</p>
<p>If you concern too much , nothing will be done before everything is perfect.</p>
<p>It&#8217;s not reasonable to exchange data between two same class object by different<br />
allocator. It won&#8217;t and should&#8217;nt be happened in real work. Unless the coder is idiot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Stroustrup &amp; Sutter on C++ by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4683</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 03 Oct 2008 10:47:45 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4683</guid>
		<description>很貴吧~ 其實我也是今天才注意到這個 event. 若早個幾週或一個月知道, 我很可能會跟上司談談看有沒有可能讓公司出錢給我去參加. (我現在服務的公司每年都送不少 technical staff 去參加國際性的訓練與研討會) 殘念...

我也對 concurrency 很有興趣, 希望有機會能交流彼此己的心得.</description>
		<content:encoded><![CDATA[<p>很貴吧~ 其實我也是今天才注意到這個 event. 若早個幾週或一個月知道, 我很可能會跟上司談談看有沒有可能讓公司出錢給我去參加. (我現在服務的公司每年都送不少 technical staff 去參加國際性的訓練與研討會) 殘念&#8230;</p>
<p>我也對 concurrency 很有興趣, 希望有機會能交流彼此己的心得.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Stroustrup &amp; Sutter on C++ by 半路</title>
		<link>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4680</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Fri, 03 Oct 2008 05:22:02 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/10/03/stroustrup-and-sutter-on-cpp/#comment-4680</guid>
		<description>我的天，票價真是貴得驚人。 Orz
如果我現在身在 Boston 說不定會考慮看看。 XD

看了你的幾篇文章介紹後，我也開始閱讀 Sutter 的部落格了。
目前特別感興趣的是關於 Concurrency 主題的文章。</description>
		<content:encoded><![CDATA[<p>我的天，票價真是貴得驚人。 Orz<br />
如果我現在身在 Boston 說不定會考慮看看。 XD</p>
<p>看了你的幾篇文章介紹後，我也開始閱讀 Sutter 的部落格了。<br />
目前特別感興趣的是關於 Concurrency 主題的文章。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 詳細錯誤說明的重要性 by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/09/26/importance-of-error-definition-in-document/#comment-4679</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 03 Oct 2008 03:12:33 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/09/26/importance-of-error-definition-in-document/#comment-4679</guid>
		<description>是啊. 但我想你也是知道的, &lt;code&gt;fopen_s&lt;/code&gt; 沒有在這方面得到 special treatment.</description>
		<content:encoded><![CDATA[<p>是啊. 但我想你也是知道的, <code>fopen_s</code> 沒有在這方面得到 special treatment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 你們在哪裡? by 半路</title>
		<link>http://fsfoundry.org/codefreak/2008/09/27/where-are-you/#comment-4673</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Wed, 01 Oct 2008 05:36:49 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/09/27/where-are-you/#comment-4673</guid>
		<description>我偶爾也會用 Google Blog Search 找有興趣的主題。只能說繁體中文的網路資源真的太稀少了，不僅止於 C++，簡體中文的資訊數量遠勝於台灣或是繁體中文的數量，我想的確是目前的真實現況沒錯。 Orz

我也想問，where are you?</description>
		<content:encoded><![CDATA[<p>我偶爾也會用 Google Blog Search 找有興趣的主題。只能說繁體中文的網路資源真的太稀少了，不僅止於 C++，簡體中文的資訊數量遠勝於台灣或是繁體中文的數量，我想的確是目前的真實現況沒錯。 Orz</p>
<p>我也想問，where are you?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 詳細錯誤說明的重要性 by 半路</title>
		<link>http://fsfoundry.org/codefreak/2008/09/26/importance-of-error-definition-in-document/#comment-4672</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Wed, 01 Oct 2008 05:28:16 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/09/26/importance-of-error-definition-in-document/#comment-4672</guid>
		<description>Nice，如果 fopen_s 能夠得到更詳細的錯誤回報結果，或許值得一用。</description>
		<content:encoded><![CDATA[<p>Nice，如果 fopen_s 能夠得到更詳細的錯誤回報結果，或許值得一用。</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 你們在哪裡? by fr3@K</title>
		<link>http://fsfoundry.org/codefreak/2008/09/27/where-are-you/#comment-4667</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Mon, 29 Sep 2008 11:12:04 +0000</pubDate>
		<guid>http://fsfoundry.org/codefreak/2008/09/27/where-are-you/#comment-4667</guid>
		<description>謝謝 jeffhung 的建議, 我會上 cpp-tw 逛逛的.</description>
		<content:encoded><![CDATA[<p>謝謝 jeffhung 的建議, 我會上 cpp-tw 逛逛的.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
