<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Modest Destiny (Posts about C++)</title><link>https://blog.modest-destiny.com/</link><description></description><atom:link href="https://blog.modest-destiny.com/categories/c%2B%2B.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2021 Adam Basfop Cavendish </copyright><lastBuildDate>Thu, 05 Aug 2021 08:16:35 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>C/C++ Function Hooking with LD_PRELOAD</title><link>https://blog.modest-destiny.com/posts/c-cpp-function-hooking-with-ld-preload/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;p&gt;Sometimes you would like to hook the glibc functions with your own implementations so that you can hack the output or monitor some metrics. Here's a simple guideline on how to do it with LD_PRELOAD on linux.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/c-cpp-function-hooking-with-ld-preload/"&gt;Read more…&lt;/a&gt; (2 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>C++</category><guid>https://blog.modest-destiny.com/posts/c-cpp-function-hooking-with-ld-preload/</guid><pubDate>Thu, 05 Aug 2021 03:54:37 GMT</pubDate></item><item><title>Split C++ Template Declaration and Implementation</title><link>https://blog.modest-destiny.com/posts/split-cpp-template-declaration-and-implementation/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;h1&gt;Description&lt;/h1&gt;
&lt;p&gt;Splitting the template declaration and implementation is not easy in C++ because the actual templates code is generated at compile time. However, it is still possible to split them out if you do know the types that you would like to generate as the role of a library.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/split-cpp-template-declaration-and-implementation/"&gt;Read more…&lt;/a&gt; (3 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>C++</category><guid>https://blog.modest-destiny.com/posts/split-cpp-template-declaration-and-implementation/</guid><pubDate>Thu, 24 Oct 2019 15:23:17 GMT</pubDate></item><item><title>A Humble Introduction to the Basics of GDB</title><link>https://blog.modest-destiny.com/posts/a-humble-introduction-to-the-basics-of-gdb/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;h2&gt;What is GDB?&lt;/h2&gt;
&lt;p&gt;GDB is a user process that attaches on to another user process.&lt;/p&gt;
&lt;p&gt;That's all.&lt;/p&gt;
&lt;h2&gt;Project Build Type&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Debug build: &lt;code&gt;gcc -g&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Works with gdb&lt;/li&gt;
&lt;li&gt;Shows source code&lt;/li&gt;
&lt;li&gt;Easy mode&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Release with debug information build:
&lt;ul&gt;
&lt;li&gt;Works with gdb&lt;/li&gt;
&lt;li&gt;Shows source code, however messy because of optimizations&lt;/li&gt;
&lt;li&gt;Hard mode&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Release build: &lt;code&gt;gcc -O2&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Works with gdb&lt;/li&gt;
&lt;li&gt;No source code information available&lt;/li&gt;
&lt;li&gt;Debug with disassembled application&lt;/li&gt;
&lt;li&gt;Hell mode&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/a-humble-introduction-to-the-basics-of-gdb/"&gt;Read more…&lt;/a&gt; (6 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>C</category><category>C++</category><category>GDB</category><guid>https://blog.modest-destiny.com/posts/a-humble-introduction-to-the-basics-of-gdb/</guid><pubDate>Thu, 07 Jul 2016 07:29:49 GMT</pubDate></item><item><title>Sequence Point</title><link>https://blog.modest-destiny.com/posts/sequence-point/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;p&gt;Ref: &lt;a href="http://blog.tinlans.org/2010/08/06/sequence-point/"&gt;http://blog.tinlans.org/2010/08/06/sequence-point/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/sequence-point/"&gt;Read more…&lt;/a&gt; (4 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>C</category><category>C++</category><category>voices-of-the-world</category><guid>https://blog.modest-destiny.com/posts/sequence-point/</guid><pubDate>Wed, 16 Sep 2015 08:47:33 GMT</pubDate></item><item><title>"Undefined reference to ..." How can I find the library to link to?</title><link>https://blog.modest-destiny.com/posts/undefined-reference-to-how-can-i-find-the-library-to-link-to/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;p&gt;The most panicking error among all the make errors is the &lt;code&gt;undefined reference&lt;/code&gt; error, which is mostly cause by an unlinked library.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/undefined-reference-to-how-can-i-find-the-library-to-link-to/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>Bash</category><category>C</category><category>C++</category><guid>https://blog.modest-destiny.com/posts/undefined-reference-to-how-can-i-find-the-library-to-link-to/</guid><pubDate>Tue, 12 May 2015 04:00:21 GMT</pubDate></item><item><title>Qt 5.1.0 on Ubuntu Linux, MySQL database connection problem, driver not loaded problem</title><link>https://blog.modest-destiny.com/posts/qt-510-on-ubuntu-linux-mysql-database-connection-problem-driver-not-loaded-problem/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;h2&gt;Problem description&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-shell"&gt;QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/qt-510-on-ubuntu-linux-mysql-database-connection-problem-driver-not-loaded-problem/"&gt;Read more…&lt;/a&gt; (3 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>C++</category><category>Qt</category><category>Qt5</category><guid>https://blog.modest-destiny.com/posts/qt-510-on-ubuntu-linux-mysql-database-connection-problem-driver-not-loaded-problem/</guid><pubDate>Mon, 17 Nov 2014 07:08:06 GMT</pubDate></item><item><title>如何在C++03中模擬C++11的右值引用std::move特性</title><link>https://blog.modest-destiny.com/posts/ru-he-zai-cpp-03-zhong-mo-ni-cpp-11-de-you-zhi-yin-yong-std-move-te-xing/</link><dc:creator>Adam Basfop Cavendish</dc:creator><description>&lt;div&gt;&lt;p&gt;最後修改時間：2013.03.19 -- 13:08&lt;/p&gt;
&lt;h2&gt;引言&lt;/h2&gt;
&lt;p&gt;衆所周知，C++11的新特性中有一個非常重要的特性，那就是&lt;code&gt;rvalue reference&lt;/code&gt;，右值引用。&lt;/p&gt;
&lt;p&gt;引入它的一個非常重要的原因是因爲在C++中，常常右值，通俗地講"在等號右邊的"臨時變量或者臨時對象， 我們是無法得到它的修改權限的。&lt;/p&gt;
&lt;p&gt;由於類的構造和析構機制，往往產生的臨時變量或臨時對象的拷貝構造及析構，會帶來不少的時間、資源消耗。&lt;/p&gt;
&lt;p&gt;也同樣由於這樣的限制，有不少C++程序員依然保有一部分C風格的寫法，例如將&lt;code&gt;A = factory(B, C);&lt;/code&gt; 之中的&lt;code&gt;A&lt;/code&gt;，以函數引用參數的形式傳入等等。 但在C++11之後，我們可以完全保留C++的寫法， 將右值明顯指出，就可以完成"直接獲得臨時對象"的資源的權限，例如&lt;code&gt;A = std::move(B);&lt;/code&gt; 或者 &lt;code&gt;A = factory(B, C);&lt;/code&gt;， 這時候就"幾乎完全"省去了拷貝的過程，通過直接獲取由&lt;code&gt;factory(B, C)&lt;/code&gt;造出的臨時對象中的資源， 達到省略拷貝的過程，最終析構的臨時對象，實際上只是一具空空的皮囊。&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.modest-destiny.com/posts/ru-he-zai-cpp-03-zhong-mo-ni-cpp-11-de-you-zhi-yin-yong-std-move-te-xing/"&gt;Read more…&lt;/a&gt; (9 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>C++</category><category>C++11</category><guid>https://blog.modest-destiny.com/posts/ru-he-zai-cpp-03-zhong-mo-ni-cpp-11-de-you-zhi-yin-yong-std-move-te-xing/</guid><pubDate>Tue, 19 Mar 2013 05:08:56 GMT</pubDate></item></channel></rss>