<?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: Implementing dprintf() with __VA_ARGS__</title>
	<atom:link href="http://www.jeffhung.net/blog/articles/jeffhung/1013/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/</link>
	<description>(My smile insists of having nose. :-)</description>
	<lastBuildDate>Thu, 03 Nov 2011 00:43:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2-alpha</generator>
	<item>
		<title>By: sunnyhaha</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-175997</link>
		<dc:creator>sunnyhaha</dc:creator>
		<pubDate>Thu, 01 Sep 2011 08:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-175997</guid>
		<description>可以在__VA_ARGS__之前加##，也就是使用：
##__VA_ARGS__这种方式。

这样可以避免零个参数而产生的错误。

============================================
窃以为，零个参数的情况应该把它当成错误报告出来，而不是让它编译通过。</description>
		<content:encoded><![CDATA[<p>可以在__VA_ARGS__之前加##，也就是使用：<br />
##__VA_ARGS__这种方式。</p>
<p>这样可以避免零个参数而产生的错误。</p>
<p>============================================<br />
窃以为，零个参数的情况应该把它当成错误报告出来，而不是让它编译通过。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sunnyhaha</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-175996</link>
		<dc:creator>sunnyhaha</dc:creator>
		<pubDate>Thu, 01 Sep 2011 08:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-175996</guid>
		<description>可以在__VA_ARGS__之前加##，也就是使用：
##__VA_ARGS__这种方式。

这样可以避免零个参数而产生的错误。

===============================
零个参数的错误应该报告出来，而不是让它编译通过。
窃以为，加##的这种方法是不可取的。</description>
		<content:encoded><![CDATA[<p>可以在__VA_ARGS__之前加##，也就是使用：<br />
##__VA_ARGS__这种方式。</p>
<p>这样可以避免零个参数而产生的错误。</p>
<p>===============================<br />
零个参数的错误应该报告出来，而不是让它编译通过。<br />
窃以为，加##的这种方法是不可取的。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: novus</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-175290</link>
		<dc:creator>novus</dc:creator>
		<pubDate>Sat, 13 Nov 2010 04:29:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-175290</guid>
		<description>剛好前陣子在 survey 一些 debuging output 的實作，路過了這系列精彩的文章。

我必須說您在 v2 幾乎就快達成目的了，就差臨門一腳卻沒有繼續堅持下去。

#ifndef NDEBUG
#  define DPRINTF  dprintf_impl
#else
#  define DPRINTF  (1)? (void) 0 : dprintf_impl
// alt. solution:  if (0) dprintf_impl
#endif

關鍵在於把 dprintf_impl 放在絕對不會被執行到的路徑上。這是所有最佳化當中最基本的類型，幾乎可以保證會被編譯器發現。

就算是在最壞的情況下編譯器照原意編出，至少也不會有副作用，頂多是浪費一個分支指令，況且對這個分支行為的預測總是非常準確。</description>
		<content:encoded><![CDATA[<p>剛好前陣子在 survey 一些 debuging output 的實作，路過了這系列精彩的文章。</p>
<p>我必須說您在 v2 幾乎就快達成目的了，就差臨門一腳卻沒有繼續堅持下去。</p>
<p>#ifndef NDEBUG<br />
#  define DPRINTF  dprintf_impl<br />
#else<br />
#  define DPRINTF  (1)? (void) 0 : dprintf_impl<br />
// alt. solution:  if (0) dprintf_impl<br />
#endif</p>
<p>關鍵在於把 dprintf_impl 放在絕對不會被執行到的路徑上。這是所有最佳化當中最基本的類型，幾乎可以保證會被編譯器發現。</p>
<p>就算是在最壞的情況下編譯器照原意編出，至少也不會有副作用，頂多是浪費一個分支指令，況且對這個分支行為的預測總是非常準確。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cocobear</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-141566</link>
		<dc:creator>cocobear</dc:creator>
		<pubDate>Sun, 31 May 2009 03:52:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-141566</guid>
		<description>可以在__VA_ARGS__之前加##，也就是使用：
##__VA_ARGS__这种方式。

这样可以避免零个参数而产生的错误。</description>
		<content:encoded><![CDATA[<p>可以在__VA_ARGS__之前加##，也就是使用：<br />
##__VA_ARGS__这种方式。</p>
<p>这样可以避免零个参数而产生的错误。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AceLan</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-77258</link>
		<dc:creator>AceLan</dc:creator>
		<pubDate>Sun, 30 Sep 2007 01:14:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-77258</guid>
		<description>FYI.
http://x-solve.com/blog/?p=15

期待你下一篇 關於 VC6 __VA_ARGS__ 的解法 ^^</description>
		<content:encoded><![CDATA[<p>FYI.<br />
<a href="http://x-solve.com/blog/?p=15" rel="nofollow">http://x-solve.com/blog/?p=15</a></p>
<p>期待你下一篇 關於 VC6 __VA_ARGS__ 的解法 ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abin</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-76956</link>
		<dc:creator>abin</dc:creator>
		<pubDate>Wed, 26 Sep 2007 20:11:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-76956</guid>
		<description>謝謝您的回覆.
查了一下您所說的TLS ..還是不太懂這跟  lacking of __VA_ARGS__ in VC6
之間的關連. 我還是等您的續篇好了..再次謝謝您了~</description>
		<content:encoded><![CDATA[<p>謝謝您的回覆.<br />
查了一下您所說的TLS ..還是不太懂這跟  lacking of __VA_ARGS__ in VC6<br />
之間的關連. 我還是等您的續篇好了..再次謝謝您了~</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-76320</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Fri, 21 Sep 2007 02:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-76320</guid>
		<description>&lt;p&gt;abin,&lt;/p&gt;
&lt;p&gt;好酒陳甕底，啊，不是，寫文章要花很多時間，這一篇前前後後也花了十天才寫完。第二集技術方面已經沒問題了，但是需要時間鋪陳，化為文字與適於講解的範例，加上最近工作很忙，回到家就累攤了，所以只好請您等等囉。&lt;/p&gt;
&lt;p&gt;不過可以先透漏一下解法的關鍵字：(C++ &#124;&#124; TLS)，後者是 Thread Local Storage 的縮寫，請注意 expression shortcut 的效果。&lt;/p&gt;
&lt;p&gt;ps. 這一系列有三集，第三集有方向了，但是詳細解法尚待思量。&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>abin,</p>
<p>好酒陳甕底，啊，不是，寫文章要花很多時間，這一篇前前後後也花了十天才寫完。第二集技術方面已經沒問題了，但是需要時間鋪陳，化為文字與適於講解的範例，加上最近工作很忙，回到家就累攤了，所以只好請您等等囉。</p>
<p>不過可以先透漏一下解法的關鍵字：(C++ || TLS)，後者是 Thread Local Storage 的縮寫，請注意 expression shortcut 的效果。</p>
<p>ps. 這一系列有三集，第三集有方向了，但是詳細解法尚待思量。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abin</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1013/comment-page-1/#comment-76316</link>
		<dc:creator>abin</dc:creator>
		<pubDate>Fri, 21 Sep 2007 00:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1013/#comment-76316</guid>
		<description>看了您的這篇文章後,受益匪淺..寫的真是太詳細了.
我剛好也有相同的應用.這這種方式除錯及trace真是太方便了.
只是我會在多加上 時間差 以及 ThreadID ,並且輸出到 debug view(http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx)
還有我多加了一個 depth 參數, 用來讓除錯時有層次以及計算不同層次中的時間差( 例如 main depth 為 0 , main-&gt;funcA() 為 1)
ThreadID 主要是可以適用於 multithread 的狀況下, 
時間差主要是可以找出程式效能瓶頸.
使用debug view主要是讓程式在web上依然能夠除錯.
而且我會有一個 method 列出所有 thread 目前所 RUN 到的位置.. 用來檢查是不是有 deadlock
以上這幾點提供您參考.

另外關於您的續篇..《Workaround: lacking of __VA_ARGS__ in VC6》
可不可以先透漏一點技巧給我呢? 關於這方面我找了很久.還是找不到相關資料..
再次謝謝您寫這麼精闢的文章分享
也歡迎加入我的 msn 大家有空聊寥程式心得</description>
		<content:encoded><![CDATA[<p>看了您的這篇文章後,受益匪淺..寫的真是太詳細了.<br />
我剛好也有相同的應用.這這種方式除錯及trace真是太方便了.<br />
只是我會在多加上 時間差 以及 ThreadID ,並且輸出到 debug view(http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx)<br />
還有我多加了一個 depth 參數, 用來讓除錯時有層次以及計算不同層次中的時間差( 例如 main depth 為 0 , main-&gt;funcA() 為 1)<br />
ThreadID 主要是可以適用於 multithread 的狀況下,<br />
時間差主要是可以找出程式效能瓶頸.<br />
使用debug view主要是讓程式在web上依然能夠除錯.<br />
而且我會有一個 method 列出所有 thread 目前所 RUN 到的位置.. 用來檢查是不是有 deadlock<br />
以上這幾點提供您參考.</p>
<p>另外關於您的續篇..《Workaround: lacking of __VA_ARGS__ in VC6》<br />
可不可以先透漏一點技巧給我呢? 關於這方面我找了很久.還是找不到相關資料..<br />
再次謝謝您寫這麼精闢的文章分享<br />
也歡迎加入我的 msn 大家有空聊寥程式心得</p>
]]></content:encoded>
	</item>
</channel>
</rss>

