<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: #define N 3</title>
	<atom:link href="http://www.jeffhung.net/blog/articles/jeffhung/599/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffhung.net/blog/articles/jeffhung/599/</link>
	<description>(My smile insists of having nose. :-)</description>
	<lastBuildDate>Mon, 26 Jul 2010 16:16:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9188</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Wed, 04 Oct 2006 07:37:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9188</guid>
		<description>&lt;p&gt;fr3@K,&lt;/p&gt;
&lt;p&gt;這算是目前蠻常見的笑點，國防役一般要服役四年才能畢業。我還要再一年半，所以是國防役服了兩年半。不過，我大五延畢了一年出去工作，part-time 算 1/2 好了，所以算來目前的工作經歷是三年。&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>fr3@K,</p>
<p>這算是目前蠻常見的笑點，國防役一般要服役四年才能畢業。我還要再一年半，所以是國防役服了兩年半。不過，我大五延畢了一年出去工作，part-time 算 1/2 好了，所以算來目前的工作經歷是三年。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fr3@K</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9093</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Sat, 30 Sep 2006 10:05:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9093</guid>
		<description>因為我看到你說還有一年半畢業, 看來你說的畢業不會是學業上的畢業. 那到底是?</description>
		<content:encoded><![CDATA[<p>因為我看到你說還有一年半畢業, 看來你說的畢業不會是學業上的畢業. 那到底是?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: b6s</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9089</link>
		<dc:creator>b6s</dc:creator>
		<pubDate>Sat, 30 Sep 2006 05:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9089</guid>
		<description>jeffhung:
I cannot agree with you more. XD</description>
		<content:encoded><![CDATA[<p>jeffhung:<br />
I cannot agree with you more. XD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9088</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Sat, 30 Sep 2006 02:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9088</guid>
		<description>&lt;p&gt;fr3@K,&lt;/p&gt;
&lt;p&gt;我現在「三年級」，就快可以「畢業」了。:-p&lt;/p&gt;
&lt;p&gt;又，為什麼一開始會說我還是學生呢？&lt;/p&gt;
&lt;p&gt;b6s,&lt;/p&gt;
&lt;p&gt;我的經驗是，用 &lt;code class=&quot;inline_code&quot;&gt;std::string&lt;/code&gt; 最好還是用 (position, length) 的方法撰寫演算法，而不要用 (begin,end)，各種詭異的東西太多啦。&lt;/p&gt;
&lt;p&gt;另外，VC6 裡的 &lt;code class=&quot;inline_code&quot;&gt;std::string&lt;/code&gt; 也沒有 &lt;code class=&quot;inline_code&quot;&gt;clear()&lt;/code&gt; 跟 &lt;code class=&quot;inline_code&quot;&gt;at()&lt;/code&gt; 可用，很討厭。前者可以用 &lt;code class=&quot;inline_code&quot;&gt;s = &quot;&quot;&lt;/code&gt; 來取代&lt;span class=&quot;footnote&quot;&gt;但是如果不曉得 &lt;code class=&quot;inline_code&quot;&gt;s&lt;/code&gt; 是用 &lt;code class=&quot;inline_code&quot;&gt;char&lt;/code&gt; 還是 &lt;code class=&quot;inline_code&quot;&gt;wchar_t&lt;/code&gt; 的話，就比較麻煩了。&lt;/span&gt;，後者則可以在前面放個 assertion 事先檢查 boundary，但這樣程式會非常醜。&lt;br /&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>fr3@K,</p>
<p>我現在「三年級」，就快可以「畢業」了。:-p</p>
<p>又，為什麼一開始會說我還是學生呢？</p>
<p>b6s,</p>
<p>我的經驗是，用 <code class="inline_code">std::string</code> 最好還是用 (position, length) 的方法撰寫演算法，而不要用 (begin,end)，各種詭異的東西太多啦。</p>
<p>另外，VC6 裡的 <code class="inline_code">std::string</code> 也沒有 <code class="inline_code">clear()</code> 跟 <code class="inline_code">at()</code> 可用，很討厭。前者可以用 <code class="inline_code">s = &quot;&quot;</code> 來取代<span class="footnote">但是如果不曉得 <code class="inline_code">s</code> 是用 <code class="inline_code">char</code> 還是 <code class="inline_code">wchar_t</code> 的話，就比較麻煩了。</span>，後者則可以在前面放個 assertion 事先檢查 boundary，但這樣程式會非常醜。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: b6s</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9087</link>
		<dc:creator>b6s</dc:creator>
		<pubDate>Fri, 29 Sep 2006 12:15:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9087</guid>
		<description>fr3@k:
有 :)
Exceptional C++ 確實很實用。前陣子剛好用裡面提到 end() 實作差異的例子，試圖在 bbs 上唬爛說為什麼 VC6 有時候如果不用 string::npos 而用 string::end 會出現靈異現象。</description>
		<content:encoded><![CDATA[<p>fr3@k:<br />
有 :)<br />
Exceptional C++ 確實很實用。前陣子剛好用裡面提到 end() 實作差異的例子，試圖在 bbs 上唬爛說為什麼 VC6 有時候如果不用 string::npos 而用 string::end 會出現靈異現象。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fr3@K</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9086</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 29 Sep 2006 10:28:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9086</guid>
		<description>突然發現有你照片的連結. 看來你應該跟我差不多年紀.
剛吃了你豆腐, sorry...</description>
		<content:encoded><![CDATA[<p>突然發現有你照片的連結. 看來你應該跟我差不多年紀.<br />
剛吃了你豆腐, sorry...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fr3@K</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-9085</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 29 Sep 2006 10:23:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-9085</guid>
		<description>jeff,
原來你還是學生啊... 看你寫的東西一直以為你是已經工作數年的老弟, 原來只是個小弟啊, 呵呵～～ 

b6s,
不知道你有沒有看過 Exceptional C++, 個人喜愛勝過 Effective 系列. 推薦!</description>
		<content:encoded><![CDATA[<p>jeff,<br />
原來你還是學生啊... 看你寫的東西一直以為你是已經工作數年的老弟, 原來只是個小弟啊, 呵呵～～ </p>
<p>b6s,<br />
不知道你有沒有看過 Exceptional C++, 個人喜愛勝過 Effective 系列. 推薦!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-8278</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Mon, 11 Sep 2006 16:38:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-8278</guid>
		<description>&lt;p&gt;Jefferl,&lt;/p&gt;
&lt;p&gt;用 editor 做 replace，就跟 &lt;code class=&quot;inline_code&quot;&gt;#define&lt;/code&gt; 的代換一樣，是字串的代換，如果 replace 的方式不好的話，還會更糟。試問，把 &lt;code class=&quot;inline_code&quot;&gt;N&lt;/code&gt; 換成 &lt;code class=&quot;inline_code&quot;&gt;MODEL_NUM&lt;/code&gt;，會不會不小心把 &lt;code class=&quot;inline_code&quot;&gt;GetFooNum()&lt;/code&gt; 變成 &lt;code class=&quot;inline_code&quot;&gt;GetFooMODEL_NUMum()&lt;/code&gt; 了呢？&lt;/p&gt;
&lt;p&gt;更甚者，&lt;code class=&quot;inline_code&quot;&gt;#define N 3&lt;/code&gt; 是某個 library 的 header，今天我們改了現在看到的有限幾個 libraries/executables 的 source，誰知道還有沒有其他 libraries/executables 也 depend 到 &lt;code class=&quot;inline_code&quot;&gt;N&lt;/code&gt; 所在的這個 library？&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Jefferl,</p>
<p>用 editor 做 replace，就跟 <code class="inline_code">#define</code> 的代換一樣，是字串的代換，如果 replace 的方式不好的話，還會更糟。試問，把 <code class="inline_code">N</code> 換成 <code class="inline_code">MODEL_NUM</code>，會不會不小心把 <code class="inline_code">GetFooNum()</code> 變成 <code class="inline_code">GetFooMODEL_NUMum()</code> 了呢？</p>
<p>更甚者，<code class="inline_code">#define N 3</code> 是某個 library 的 header，今天我們改了現在看到的有限幾個 libraries/executables 的 source，誰知道還有沒有其他 libraries/executables 也 depend 到 <code class="inline_code">N</code> 所在的這個 library？</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jefferl</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-8273</link>
		<dc:creator>Jefferl</dc:creator>
		<pubDate>Mon, 11 Sep 2006 10:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-8273</guid>
		<description>想了一下用這樣比較好

enum
{
   N = 3
};

之後可以用 local 定義來宣告新的變數
int N=8;  // 以下的scope 就會是 整數變數了.

總而言之  #define 的破壞力太大了...</description>
		<content:encoded><![CDATA[<p>想了一下用這樣比較好</p>
<p>enum<br />
{<br />
   N = 3<br />
};</p>
<p>之後可以用 local 定義來宣告新的變數<br />
int N=8;  // 以下的scope 就會是 整數變數了.</p>
<p>總而言之  #define 的破壞力太大了...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jefferl</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-8272</link>
		<dc:creator>Jefferl</dc:creator>
		<pubDate>Mon, 11 Sep 2006 09:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-8272</guid>
		<description>看到這個馬上把它用 editor replace

#define MODEL_NUM  3

所有  N 全部換成  MODEL_NUM</description>
		<content:encoded><![CDATA[<p>看到這個馬上把它用 editor replace</p>
<p>#define MODEL_NUM  3</p>
<p>所有  N 全部換成  MODEL_NUM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-8247</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Sun, 10 Sep 2006 08:45:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-8247</guid>
		<description>&lt;p&gt;Dear ebs,&lt;/p&gt;
&lt;p&gt;是啊，不能用 &lt;code class=&quot;inline_code&quot;&gt;N&lt;/code&gt;，可是會很痛苦的。因為這樣一來，你就不能 &lt;code class=&quot;inline_code&quot;&gt;#include &lt;windows.h&gt;&lt;/code&gt;，在 &lt;code class=&quot;inline_code&quot;&gt;&lt;windows.h&gt;&lt;/code&gt; 裡面有個 structure 有個欄位，就叫做 &lt;code class=&quot;inline_code&quot;&gt;N&lt;/code&gt;。:-p&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Dear ebs,</p>
<p>是啊，不能用 <code class="inline_code">N</code>，可是會很痛苦的。因為這樣一來，你就不能 <code class="inline_code">#include &lt;windows.h&gt;</code>，在 <code class="inline_code">&lt;windows.h&gt;</code> 裡面有個 structure 有個欄位，就叫做 <code class="inline_code">N</code>。:-p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ebs</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-8245</link>
		<dc:creator>ebs</dc:creator>
		<pubDate>Sun, 10 Sep 2006 08:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-8245</guid>
		<description>小弟愚昧，請教一下這樣寫的缺點是什麼？
別人無法使用 N 當變數名稱？</description>
		<content:encoded><![CDATA[<p>小弟愚昧，請教一下這樣寫的缺點是什麼？<br />
別人無法使用 N 當變數名稱？</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: b6s</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-7934</link>
		<dc:creator>b6s</dc:creator>
		<pubDate>Fri, 25 Aug 2006 05:53:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-7934</guid>
		<description>唔，我剛好也碰上類似的問題。
昨天和同事在聊天討論，基於敝單位的需求，趕快寫出會動的東西比較重要，於是有時候他們會覺得我想太多了……
Domain knowledge 決定了那東西會不會動；
C/C++ 的 knowledge 則暗示了交接傳承或分工合作的某種難易度？
在這個情況下，「只有我會寫」的程式好像最有價值。
orz</description>
		<content:encoded><![CDATA[<p>唔，我剛好也碰上類似的問題。<br />
昨天和同事在聊天討論，基於敝單位的需求，趕快寫出會動的東西比較重要，於是有時候他們會覺得我想太多了……<br />
Domain knowledge 決定了那東西會不會動；<br />
C/C++ 的 knowledge 則暗示了交接傳承或分工合作的某種難易度？<br />
在這個情況下，「只有我會寫」的程式好像最有價值。<br />
orz</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-7927</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Thu, 24 Aug 2006 15:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-7927</guid>
		<description>&lt;p&gt;其實，真正掌握 domain knowledge 的話，就算只有看過《&lt;a href=&quot;http://www.amazon.com/gp/product/0131103628/sr=8-1/qid=1156434499/ref=pd_bbs_1/002-6521296-1875242?ie=UTF8&quot; rel=&quot;nofollow&quot;&gt;The C Programming Language&lt;/a&gt;》也是足夠的。&lt;/p&gt;
&lt;p&gt;喔，我是在說真的，不是在開玩笑。就算我兩年寫出來的 code，行數差不多，&lt;a href=&quot;http://www.dwheeler.com/sloccount/&quot; rel=&quot;nofollow&quot;&gt;sloccount&lt;/a&gt; 算出來的分數，比公司前輩花五年寫出來的，差不多行數的程式還要高十倍，但我的程式的價值，還是比不上前輩的程式。&lt;/p&gt;
&lt;p&gt;所以，我的價值在哪裡呢？&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>其實，真正掌握 domain knowledge 的話，就算只有看過《<a href="http://www.amazon.com/gp/product/0131103628/sr=8-1/qid=1156434499/ref=pd_bbs_1/002-6521296-1875242?ie=UTF8" rel="nofollow">The C Programming Language</a>》也是足夠的。</p>
<p>喔，我是在說真的，不是在開玩笑。就算我兩年寫出來的 code，行數差不多，<a href="http://www.dwheeler.com/sloccount/" rel="nofollow">sloccount</a> 算出來的分數，比公司前輩花五年寫出來的，差不多行數的程式還要高十倍，但我的程式的價值，還是比不上前輩的程式。</p>
<p>所以，我的價值在哪裡呢？</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: b6s</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-7918</link>
		<dc:creator>b6s</dc:creator>
		<pubDate>Thu, 24 Aug 2006 06:00:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-7918</guid>
		<description>看來他們都沒有看 Effective C++...</description>
		<content:encoded><![CDATA[<p>看來他們都沒有看 Effective C++...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-7913</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Thu, 24 Aug 2006 02:13:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-7913</guid>
		<description>&lt;p&gt;這問題就跟 MySQL 的 &lt;code class=&quot;inline_code&quot;&gt;&lt;mysql.h&gt;&lt;/code&gt; 一樣，裡面會有個：&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;#define DB foobar&lt;/pre&gt;
&lt;p&gt;害得我必須要特別為 MySQL 做一個轉接的 class，以便把 &lt;code class=&quot;inline_code&quot;&gt;#include &lt;mysql.h&gt;&lt;/code&gt; 鎖在一個獨立的 compilation unit 裡。&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>這問題就跟 MySQL 的 <code class="inline_code">&lt;mysql.h&gt;</code> 一樣，裡面會有個：</p>
<pre class="code">#define DB foobar</pre>
<p>害得我必須要特別為 MySQL 做一個轉接的 class，以便把 <code class="inline_code">#include &lt;mysql.h&gt;</code> 鎖在一個獨立的 compilation unit 裡。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yungyuc</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/599/comment-page-1/#comment-7906</link>
		<dc:creator>yungyuc</dc:creator>
		<pubDate>Wed, 23 Aug 2006 12:44:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/599/#comment-7906</guid>
		<description>或許你該寫些 #define NN 9 // square of number of the state of a xxx model.

:p</description>
		<content:encoded><![CDATA[<p>或許你該寫些 #define NN 9 // square of number of the state of a xxx model.</p>
<p>:p</p>
]]></content:encoded>
	</item>
</channel>
</rss>
