﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Apollo Fang's Blog-随笔分类-Miscellaneous</title><link>http://www.cppblog.com/scorpio/category/19469.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 01 Nov 2012 11:01:32 GMT</lastBuildDate><pubDate>Thu, 01 Nov 2012 11:01:32 GMT</pubDate><ttl>60</ttl><item><title>VI十六进制模式正常模式切换</title><link>http://www.cppblog.com/scorpio/archive/2012/10/31/163776.html</link><dc:creator>Apollo Fang</dc:creator><author>Apollo Fang</author><pubDate>Wed, 31 Oct 2012 09:16:00 GMT</pubDate><guid>http://www.cppblog.com/scorpio/archive/2012/10/31/163776.html</guid><wfw:comment>http://www.cppblog.com/scorpio/comments/163776.html</wfw:comment><comments>http://www.cppblog.com/scorpio/archive/2012/10/31/163776.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/scorpio/comments/commentRss/163776.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/scorpio/services/trackbacks/163776.html</trackback:ping><description><![CDATA[<span style="font-family: Courier; ">VIM显示十六进制的方法- %!xxd<br /></span><span style="font-family: Courier; ">VIM回复正常显示方法- %!xxd -r</span><img src ="http://www.cppblog.com/scorpio/aggbug/163776.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/scorpio/" target="_blank">Apollo Fang</a> 2012-10-31 17:16 <a href="http://www.cppblog.com/scorpio/archive/2012/10/31/163776.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>What is "##" string in C code</title><link>http://www.cppblog.com/scorpio/archive/2012/06/08/177471.html</link><dc:creator>Apollo Fang</dc:creator><author>Apollo Fang</author><pubDate>Fri, 08 Jun 2012 02:42:00 GMT</pubDate><guid>http://www.cppblog.com/scorpio/archive/2012/06/08/177471.html</guid><wfw:comment>http://www.cppblog.com/scorpio/comments/177471.html</wfw:comment><comments>http://www.cppblog.com/scorpio/archive/2012/06/08/177471.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/scorpio/comments/commentRss/177471.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/scorpio/services/trackbacks/177471.html</trackback:ping><description><![CDATA[<div><span style="font-family: Georgia; ">See code below(</span><span style="font-family: Georgia; color: red; "><em>quoting ffmpeg source code</em></span><span style="font-family: 'Lucida Console'; ">)<br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; font-family: Courier; ">&nbsp;1</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">#define</span><span style="font-family: Courier; ">&nbsp;REGISTER_MUXER(X,x)&nbsp;{&nbsp;\</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;2</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">&nbsp; &nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">e</span><span style="color: #0000ff; font-family: Courier; ">xtern</span><span style="font-family: Courier; ">&nbsp;AVOutputFormat&nbsp;x##_muxer;&nbsp;\</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;3</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">&nbsp; &nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">i</span><span style="color: #0000ff; font-family: Courier; ">f</span><span style="font-family: Courier; ">(CONFIG_##X##_MUXER)&nbsp;av_register_output_format(</span><span style="font-family: Courier; ">&amp;</span><span style="font-family: Courier; ">x##_muxer);&nbsp;}</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;4</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">#define</span><span style="font-family: Courier; ">&nbsp;REGISTER_DEMUXER(X,x)&nbsp;{&nbsp;\</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;5</span>&nbsp;<span style="font-family: Courier; "> &nbsp; &nbsp;</span><span style="color: #0000ff; font-family: Courier; ">extern</span><span style="font-family: Courier; ">&nbsp;AVInputFormat&nbsp;x##_demuxer;&nbsp;\</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;6</span>&nbsp;<span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">if</span><span style="font-family: Courier; ">(CONFIG_##X##_DEMUXER)&nbsp;av_register_input_format(</span><span style="font-family: Courier; ">&amp;</span><span style="font-family: Courier; ">x##_demuxer);&nbsp;}</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;7</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">#define</span><span style="font-family: Courier; ">&nbsp;REGISTER_MUXDEMUX(X,x)&nbsp;&nbsp;REGISTER_MUXER(X,x);&nbsp;REGISTER_DEMUXER(X,x)</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;8</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">#define</span><span style="font-family: Courier; ">&nbsp;REGISTER_PROTOCOL(X,x)&nbsp;{&nbsp;\</span><br /><span style="color: #008080; font-family: Courier; ">&nbsp;9</span>&nbsp;<span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">extern</span><span style="font-family: Courier; ">&nbsp;URLProtocol&nbsp;x##_protocol;&nbsp;\</span><br /><span style="color: #008080; font-family: Courier; ">10</span>&nbsp;<span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">if</span><span style="font-family: Courier; ">(CONFIG_##X##_PROTOCOL)&nbsp;av_register_protocol2(</span><span style="font-family: Courier; ">&amp;</span><span style="font-family: Courier; ">x##_protocol,&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">sizeof</span><span style="font-family: Courier; ">(x##_protocol));&nbsp;}</span></div><span style="font-family: 'Lucida Console'; "><br /></span></div><div><span style="font-family: Georgia; ">"##" string in C language code is used for </span><span style="font-family: Georgia; color: red; "><em><u>concatenating the two strings</u></em></span><span style="font-family: Georgia; color: red; "><em><u>&nbsp;which is before and behind it &nbsp;in a macros definition.</u></em></span><br /><span style="font-family: Georgia; ">See a test code below :</span><div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; font-family: Courier; ">1</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">#define</span><span style="font-family: Courier; ">&nbsp;DEFINE(t,&nbsp;x)&nbsp;&nbsp;{t&nbsp;x##_##t;}</span><font color="#008080" face="Courier"><br /></font><span style="color: #008080; font-family: Courier; ">3</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">int</span><span style="font-family: Courier; ">&nbsp;main()</span><br /><span style="color: #008080; font-family: Courier; ">4</span>&nbsp;<span style="font-family: Courier; ">{</span><br /><span style="color: #008080; font-family: Courier; ">5</span>&nbsp;<span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;DEFINE(</span><span style="color: #0000ff; font-family: Courier; ">int</span><span style="font-family: Courier; ">,&nbsp;vvv);</span><br /><span style="color: #008080; font-family: Courier; ">6</span>&nbsp;<span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">return</span>&nbsp;<span style="font-family: Courier; ">0</span><span style="font-family: Courier; ">;</span><br /><span style="color: #008080; font-family: Courier; ">7</span>&nbsp;<span style="font-family: Courier; ">}</span><font color="#008080"><br /></font></div></div><span style="font-family: 'Lucida Console'; "><br /></span><span style="font-family: Georgia; ">Use "</span><span style="font-family: Georgia; font-size: 12pt; color: red; "><u><em>gcc -E test_sharpsharp.c -o test_sharpsharp.i</em></u></span><span style="font-family: Georgia; ">" command to pre-process this file<br /></span><font face="Georgia">And the output file "test_sharpsharp.i" just looks like below :</font><font color="#008080" face="Courier" size="2"><br /></font><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; font-family: Courier; ">1</span>&nbsp;<span style="color: #0000ff; font-family: Courier; ">int</span><span style="font-family: Courier; ">&nbsp;main()</span><br /><span style="color: #008080; font-family: Courier; ">2</span>&nbsp;<span style="font-family: Courier; ">{</span><br /><span style="color: #008080; font-family: Courier; ">3</span>&nbsp;<span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="color: #0000ff; font-family: Courier; ">int</span><span style="font-family: Courier; ">&nbsp;vvv_int;};</span><br /><span style="color: #008080; font-family: Courier; ">4</span>&nbsp;<span style="font-family: Courier; "> &nbsp; &nbsp;</span><span style="color: #0000ff; font-family: Courier; ">return</span>&nbsp;<span style="font-family: Courier; ">0</span><span style="font-family: Courier; ">;</span><br /><span style="color: #008080; font-family: Courier; ">5</span>&nbsp;<span style="font-family: Courier; ">}</span></div><span style="font-family: Georgia; "><br />The code below is useful, and you can use "##" macro definitions to realize sample <em><u>templates</u></em>&nbsp;with C language<br /></span><div style="font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; font-family: Courier; ">1</span><span style="font-family: Courier; ">&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">#define</span><span style="font-family: Courier; ">&nbsp;REGISTER_DATA_COMPARE(x)\</span><br /><span style="color: #008080; font-family: Courier; ">2</span><span style="font-family: Courier; ">&nbsp;</span><span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">static</span><span style="font-family: Courier; ">&nbsp;</span><span style="font-family: Courier; color: #0000ff; ">__inline&nbsp;</span><span style="font-family: Courier; ">x&nbsp;x##_compare(x&nbsp;key1,&nbsp;x&nbsp;key2)\</span><br /><span style="color: #008080; font-family: Courier; ">3</span><span style="font-family: Courier; ">&nbsp;</span><span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Courier; ">{\</span><br /><span style="color: #008080; font-family: Courier; ">4</span><span style="font-family: Courier; ">&nbsp;</span><span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">if</span><span style="font-family: Courier; ">&nbsp;(key1&nbsp;</span><span style="font-family: Courier; ">&gt;</span><span style="font-family: Courier; ">&nbsp;key2)&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">return</span>&nbsp;<span style="font-family: Courier; ">1</span><span style="font-family: Courier; ">;\</span><br /><span style="color: #008080; font-family: Courier; ">5</span><span style="font-family: Courier; ">&nbsp;</span><span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">if</span><span style="font-family: Courier; ">&nbsp;(key1&nbsp;</span><span style="font-family: Courier; ">&lt;</span><span style="font-family: Courier; ">&nbsp;key2)&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">return</span>&nbsp;<span style="font-family: Courier; ">-</span><span style="font-family: Courier; ">1</span><span style="font-family: Courier; ">;\</span><br /><span style="color: #008080; font-family: Courier; ">6</span><span style="font-family: Courier; ">&nbsp;</span><span style="color: #0000ff; font-family: Courier; ">&nbsp; &nbsp; &nbsp; &nbsp; return</span>&nbsp;<span style="font-family: Courier; ">0</span><span style="font-family: Courier; ">;\</span><br /><span style="color: #008080; font-family: Courier; ">7</span><span style="font-family: Courier; ">&nbsp;</span><span style="font-family: Courier; ">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><span style="font-family: Georgia; ">In this way, you can realize a data comparing function set, when you need comparing some type of data, just register it.</span></div><img src ="http://www.cppblog.com/scorpio/aggbug/177471.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/scorpio/" target="_blank">Apollo Fang</a> 2012-06-08 10:42 <a href="http://www.cppblog.com/scorpio/archive/2012/06/08/177471.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How to update or install pthread manual reference on Linux</title><link>http://www.cppblog.com/scorpio/archive/2011/10/27/159215.html</link><dc:creator>Apollo Fang</dc:creator><author>Apollo Fang</author><pubDate>Thu, 27 Oct 2011 05:28:00 GMT</pubDate><guid>http://www.cppblog.com/scorpio/archive/2011/10/27/159215.html</guid><wfw:comment>http://www.cppblog.com/scorpio/comments/159215.html</wfw:comment><comments>http://www.cppblog.com/scorpio/archive/2011/10/27/159215.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/scorpio/comments/commentRss/159215.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/scorpio/services/trackbacks/159215.html</trackback:ping><description><![CDATA[<span style="font-family: 'Lucida Console'; ">&nbsp; &nbsp; If you want to install the manual reference about pthread, execute the following command:<br />
&nbsp; &nbsp;&nbsp;<br />
</span><span style="font-family: 'Lucida Console'; color: #ff0000; ">&nbsp; &nbsp; sudo apt-get install glibc-doc<br />
</span><span style="font-family: 'Lucida Console'; color: #ff0000; ">&nbsp; &nbsp; sudo apt-get install manpages-posix-dev</span><span style="font-family: 'Lucida Console'; color: #ff0000; "><br />
</span>
<div class="vimiumHUD" style="right: 150px; opacity: 0; display: none; "></div><img src ="http://www.cppblog.com/scorpio/aggbug/159215.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/scorpio/" target="_blank">Apollo Fang</a> 2011-10-27 13:28 <a href="http://www.cppblog.com/scorpio/archive/2011/10/27/159215.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How To Disable "_CRT_SECURE_NO_WARNINGS" Warnings</title><link>http://www.cppblog.com/scorpio/archive/2011/10/25/159059.html</link><dc:creator>Apollo Fang</dc:creator><author>Apollo Fang</author><pubDate>Tue, 25 Oct 2011 09:26:00 GMT</pubDate><guid>http://www.cppblog.com/scorpio/archive/2011/10/25/159059.html</guid><wfw:comment>http://www.cppblog.com/scorpio/comments/159059.html</wfw:comment><comments>http://www.cppblog.com/scorpio/archive/2011/10/25/159059.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/scorpio/comments/commentRss/159059.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/scorpio/services/trackbacks/159059.html</trackback:ping><description><![CDATA[<font class="Apple-style-span" face="'Lucida Console'"><span style="font-family: 'Lucida Console'; ">&nbsp; &nbsp; While you using MS Visual Studio, there are always "_CRT_SECURE_NO_WARNINGS" warnings appeared, like bellow:<br /></span></font><br /><span style="font-size: 12pt; font-family: 'Lucida Console'; color: red; "><em>&nbsp; &nbsp;</em></span><span style="font-family: 'Times New Roman'; font-size: 12pt; color: red; "><em>"warning C4996: 'strerror': This function or variable may be unsafe. Using strerror_s instead."</em></span><div><br /><font class="Apple-style-span" face="'Lucida Console'">&nbsp; &nbsp; How to disable this kind deprecation? Do like bellow (VS2010):</font><br /><br /><font class="Apple-style-span" face="'Lucida Console'">&nbsp; &nbsp; Project -&gt; Properties -&gt; Configuration Properties -&gt; C++ -&gt; Processor -&gt; Processor Definitions</font><br /><br /><font class="Apple-style-span" face="'Lucida Console'">&nbsp; &nbsp; And then add a macro definition&nbsp;<span style="font-family: 'Times New Roman'; color: red; "><em>"</em></span><span style="font-family: 'Times New Roman'; color: red; font-size: 12pt; "><em>_CRT_SECURE</em></span><span style="font-family: 'Times New Roman'; color: red; font-size: 12pt; "><em>_</em></span><span style="font-family: 'Times New Roman'; color: red; font-size: 12pt; "><em>NO_WARNINGS"</em></span>, and use a ";" to separated with others</font><br /><br /><font class="Apple-style-span" face="'Lucida Console'">&nbsp; &nbsp; OK, Hit OK and enjoy the silence...</font><br /><br /><br /><div style="text-align: right; "><font class="Apple-style-span" face="'Lucida Console'">Tuesday, October 25, 2011</font></div></div><span class="Apple-style-span" style="background-color: #28557e; "><font class="Apple-style-span"><span style="background-color: #28557e; "><font class="Apple-style-span" face="'Lucida Console'" size="3"><span class="Apple-style-span" style="line-height: 19px;"><br /></span></font><div></div></span></font></span><img src ="http://www.cppblog.com/scorpio/aggbug/159059.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/scorpio/" target="_blank">Apollo Fang</a> 2011-10-25 17:26 <a href="http://www.cppblog.com/scorpio/archive/2011/10/25/159059.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>