<?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: 表頭檔要不要？拿速度來換！</title>
	<atom:link href="http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not</link>
	<description>遊戲開發‧遊戲程式‧遊戲設計</description>
	<lastBuildDate>Wed, 08 Feb 2012 10:52:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-10694</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Wed, 16 Nov 2011 02:32:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-10694</guid>
		<description>@夢癡:
以多型的方式盡可能減少不必要的表頭檔參照，確實是個解決方法。

另外，我想這也是為什麼在《Design Patterns》中，作者論述「Favor composition over inheritance」的好理由之一吧。</description>
		<content:encoded><![CDATA[<p>@夢癡:<br />
以多型的方式盡可能減少不必要的表頭檔參照，確實是個解決方法。</p>
<p>另外，我想這也是為什麼在《Design Patterns》中，作者論述「Favor composition over inheritance」的好理由之一吧。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 夢癡</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-10663</link>
		<dc:creator>夢癡</dc:creator>
		<pubDate>Tue, 15 Nov 2011 04:02:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-10663</guid>
		<description>半路您好：
不小心看到這篇文章，我對於以減少相依性，提高模組化為目標（增加程式碼的Re Use程式），讓有心有戚戚焉，尤其是這三段：
如果 object references 或 object pointers 可以完成任務，就不要使用 objects。
如果能夠，盡量以 class 的宣告取代 class 的定義。
不要在表頭檔中 #include 其他表頭檔，除非你的表頭檔不這樣就無法編譯。
目前沒辦法解決的就是物件的繼承，我的做法是避免include子物件的head檔，儘量以多型的運作方式去使用parent指標來解決。真正要New物件的地方集中在一個factory來做。</description>
		<content:encoded><![CDATA[<p>半路您好：<br />
不小心看到這篇文章，我對於以減少相依性，提高模組化為目標（增加程式碼的Re Use程式），讓有心有戚戚焉，尤其是這三段：<br />
如果 object references 或 object pointers 可以完成任務，就不要使用 objects。<br />
如果能夠，盡量以 class 的宣告取代 class 的定義。<br />
不要在表頭檔中 #include 其他表頭檔，除非你的表頭檔不這樣就無法編譯。<br />
目前沒辦法解決的就是物件的繼承，我的做法是避免include子物件的head檔，儘量以多型的運作方式去使用parent指標來解決。真正要New物件的地方集中在一個factory來做。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-6522</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Fri, 18 Feb 2011 15:27:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-6522</guid>
		<description>@dejob:
你好，

其實 header guard 的作法，只能保護 header files 不會被 include 兩次以上而已，並不能降低檔案之間的依存性喔。我認為只要是使用 C++ 語言，就應該謹慎地思考實體檔案以及物件類別之間的依存性，才能夠確實地減少編譯程式碼所需的時間。</description>
		<content:encoded><![CDATA[<p>@dejob:<br />
你好，</p>
<p>其實 header guard 的作法，只能保護 header files 不會被 include 兩次以上而已，並不能降低檔案之間的依存性喔。我認為只要是使用 C++ 語言，就應該謹慎地思考實體檔案以及物件類別之間的依存性，才能夠確實地減少編譯程式碼所需的時間。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dejob</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-6512</link>
		<dc:creator>dejob</dc:creator>
		<pubDate>Fri, 18 Feb 2011 05:34:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-6512</guid>
		<description>我們以前的作法是:
1. 在每個行include都加上heaer guard. 也就是每一行include前都會有#ifndef _XXX_H
2. 在每個header file都要#define _XXX_H
這樣不僅可以降低依存性, 也能使compile time大幅提升(檔案夠多夠大的話), 可以試看看.</description>
		<content:encoded><![CDATA[<p>我們以前的作法是:<br />
1. 在每個行include都加上heaer guard. 也就是每一行include前都會有#ifndef _XXX_H<br />
2. 在每個header file都要#define _XXX_H<br />
這樣不僅可以降低依存性, 也能使compile time大幅提升(檔案夠多夠大的話), 可以試看看.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Milo</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-92</link>
		<dc:creator>Milo</dc:creator>
		<pubDate>Tue, 01 Apr 2008 17:07:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-92</guid>
		<description>看過這篇文章後，我也寫了一篇自己關於 inline function 在標頭檔的一些看法和你交流。

http://miloyip.seezone.net/?p=47

P.S. 還想問一下，你每次寫的文章都這麼詳盡，要花多少時間呢? 我寫一篇可能已經要一至三小時了。寫下去要很有恆心呢。

&lt;blockquote&gt;
&lt;strong&gt;半路：&lt;/strong&gt;
你的這個 inline function 切換方法實在是很棒很實用～
真是太感謝你的回應了。 ：D

我寫得也不算很詳盡，只是希望文章內容能夠寫得淺顯易懂些，
有時候一開始也沒打算寫這麼長，不知不覺就寫一堆了。 XD
時間上，我的寫文功力還很差，每篇至少都會花費三、四個小時吧。
不過我覺得文章長短不是問題，還是要有好內容才是重點，
你的這篇回應文章，就給了我全新實用的啟發。

能夠相互交流想法與心得，真是爽快無得比啊～ ^_^
&lt;/blockquote&gt;
</description>
		<content:encoded><![CDATA[<p>看過這篇文章後，我也寫了一篇自己關於 inline function 在標頭檔的一些看法和你交流。</p>
<p><a href="http://miloyip.seezone.net/?p=47" rel="nofollow">http://miloyip.seezone.net/?p=47</a></p>
<p>P.S. 還想問一下，你每次寫的文章都這麼詳盡，要花多少時間呢? 我寫一篇可能已經要一至三小時了。寫下去要很有恆心呢。</p>
<blockquote><p>
<strong>半路：</strong><br />
你的這個 inline function 切換方法實在是很棒很實用～<br />
真是太感謝你的回應了。 ：D</p>
<p>我寫得也不算很詳盡，只是希望文章內容能夠寫得淺顯易懂些，<br />
有時候一開始也沒打算寫這麼長，不知不覺就寫一堆了。 XD<br />
時間上，我的寫文功力還很差，每篇至少都會花費三、四個小時吧。<br />
不過我覺得文章長短不是問題，還是要有好內容才是重點，<br />
你的這篇回應文章，就給了我全新實用的啟發。</p>
<p>能夠相互交流想法與心得，真是爽快無得比啊～ ^_^
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: doomleika</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-91</link>
		<dc:creator>doomleika</dc:creator>
		<pubDate>Mon, 31 Mar 2008 08:27:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-91</guid>
		<description>我一直覺得header file的機制很不方便，每次寫/改一個class就必需重覆兩次(宣告+定義)，有時候沒處理好會出現讓人想摔鍵盤的的錯誤(像是字打錯造成undefined external reference) :(

希望未來C++09能提供更方便的支援機制。

--

當然作為一個1980年出現的語言，這樣的要求是有點過份啦._.

&lt;blockquote&gt;
&lt;strong&gt;半路：&lt;/strong&gt;
多摔幾次鍵盤以後就會學起來了。（茶） XD

C++ 會使用宣告檔案與定義檔案分離的方式，
自然有他的時代背景因素存在，在這點上大概很難做出什麼變革。

我之前一開始在用 C# 時覺得很不習慣，怎麼會把宣告和定義寫在一起？
後來用久了，反而不習慣使用 C++ 的方法了。 Orz
&lt;/blockquote&gt;
</description>
		<content:encoded><![CDATA[<p>我一直覺得header file的機制很不方便，每次寫/改一個class就必需重覆兩次(宣告+定義)，有時候沒處理好會出現讓人想摔鍵盤的的錯誤(像是字打錯造成undefined external reference) :(</p>
<p>希望未來C++09能提供更方便的支援機制。</p>
<p>&#8211;</p>
<p>當然作為一個1980年出現的語言，這樣的要求是有點過份啦._.</p>
<blockquote><p>
<strong>半路：</strong><br />
多摔幾次鍵盤以後就會學起來了。（茶） XD</p>
<p>C++ 會使用宣告檔案與定義檔案分離的方式，<br />
自然有他的時代背景因素存在，在這點上大概很難做出什麼變革。</p>
<p>我之前一開始在用 C# 時覺得很不習慣，怎麼會把宣告和定義寫在一起？<br />
後來用久了，反而不習慣使用 C++ 的方法了。 Orz
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: eguitarz</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not/comment-page-1#comment-90</link>
		<dc:creator>eguitarz</dc:creator>
		<pubDate>Mon, 31 Mar 2008 00:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/gameprog/concept/header-files-inclusion-or-not#comment-90</guid>
		<description>Nice post! 我想請問有人喜歡把#include寫在.cpp有人喜歡寫在.h中，這兩種方式會有任何差別嗎？有沒有哪種方式會比較好？

&lt;blockquote&gt;
&lt;strong&gt;半路：&lt;/strong&gt;
就像文章中所提到的內容一樣，
盡量減少在 .h 中 #include 其他 .h 的情形會比較好囉。
&lt;/blockquote&gt;
</description>
		<content:encoded><![CDATA[<p>Nice post! 我想請問有人喜歡把#include寫在.cpp有人喜歡寫在.h中，這兩種方式會有任何差別嗎？有沒有哪種方式會比較好？</p>
<blockquote><p>
<strong>半路：</strong><br />
就像文章中所提到的內容一樣，<br />
盡量減少在 .h 中 #include 其他 .h 的情形會比較好囉。
</p></blockquote>
]]></content:encoded>
	</item>
</channel>
</rss>

