<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>羅根學習筆記</title><link>https://zh-blog.logan.tw/</link><description></description><lastBuildDate>Sat, 14 Feb 2026 23:48:00 +0800</lastBuildDate><item><title>回首 2025．展望 2026</title><link>https://zh-blog.logan.tw/2026/02/14/2025-retrospect-and-2026-prospect/</link><description>&lt;p&gt;去年我成為小組主管。作為新手主管，我很多方面都經驗不足、力有未逮。感謝大家的包容和反饋。當主管和寫程式不同，很多 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 14 Feb 2026 23:48:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2026-02-14:/2026/02/14/2025-retrospect-and-2026-prospect/</guid><category>2026</category><category>python</category></item><item><title>PyPy RISCV JIT Backend 開發心得</title><link>https://zh-blog.logan.tw/2024/12/30/pypy-riscv-jit-backend-dev/</link><description>&lt;p&gt;今年我將 PyPy RISC-V JIT Backend 送回上游的 PyPy 版本庫。今年 8 月發行的 &lt;a class="reference external" href="https://pypy.org/posts/2024/08/pypy-v7317-release.html"&gt;PyPy v7.3.17&lt;/a&gt; 已經包含 RISC-V JIT Backend 的程式碼。這個 Side Project 我斷斷續續做了 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 30 Dec 2024 23:21:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2024-12-30:/2024/12/30/pypy-riscv-jit-backend-dev/</guid><category>2024</category><category>python</category></item><item><title>漫談 std::uniform_int_distribution 的原理與最佳化</title><link>https://zh-blog.logan.tw/2022/08/14/cxx-std-uniform-int-distribution/</link><description>&lt;p&gt;通常偽亂數生成器（Pseudo Random Number Generator）會生成屬於 &lt;code&gt;[0, 2^N)&lt;/code&gt; 區間的整數。此區間內每個整數被生成的機率均等。然而我們需要的亂數 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 14 Aug 2022 22:53:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2022-08-14:/2022/08/14/cxx-std-uniform-int-distribution/</guid><category>2022</category><category>cxx</category></item><item><title>一個 va_list 錯誤案例</title><link>https://zh-blog.logan.tw/2022/02/16/c-va-list-pitfall/</link><description>&lt;p&gt;最近幫別人除錯，看到一個有趣的案例。下面的程式會有 Segmentation Fault（記憶體區段錯誤），大家看得出問題嗎？&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;stdarg.h&amp;gt;&lt;/span&gt;

&lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;error_&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;report_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;struct …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 16 Feb 2022 20:58:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2022-02-16:/2022/02/16/c-va-list-pitfall/</guid><category>2022</category><category>c</category></item><item><title>std::any 使用方法</title><link>https://zh-blog.logan.tw/2021/10/31/cxx-17-std-any-usage/</link><description>&lt;p&gt;本文要介紹 C++ 17 新增的 &lt;code&gt;std::any&lt;/code&gt; 類別。它能儲存所有「可以被複製建構（Copy Constructible）」的數值。以下我們會先介紹 &lt;code&gt;std::any&lt;/code&gt; 的基本用法，接著介 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 31 Oct 2021 23:35:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2021-10-31:/2021/10/31/cxx-17-std-any-usage/</guid><category>2021</category><category>cxx</category></item><item><title>C++ 執行緒：promise、future、packaged_task 與 async 的使用方法</title><link>https://zh-blog.logan.tw/2021/09/26/cxx-thread-promise-future-packaged-task-async-usage/</link><description>&lt;p&gt;今天我想要介紹 C++ 執行緒的高階 API：&lt;code&gt;std::promise&lt;/code&gt;、&lt;code&gt;std::future&lt;/code&gt;、&lt;code&gt;std::packaged_task&lt;/code&gt; 與 &lt;code&gt;std::async&lt;/code&gt;。本文的內容可以濃縮為下圖：&lt;/p&gt;
&lt;img alt="std::future、std::promise、std::packaged_task 與 std::async 的關聯圖" src="https://zh-blog.logan.tw/static/images/2021/09/26/future-class-diagram.png" /&gt;
&lt;p&gt;其中 &lt;code&gt;std::promise&lt;/code&gt; 與 &lt;code&gt;std::future&lt;/code&gt; 是執行緒之間的 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 26 Sep 2021 22:15:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2021-09-26:/2021/09/26/cxx-thread-promise-future-packaged-task-async-usage/</guid><category>2021</category><category>cxx</category></item><item><title>C++ std::thread join() 與解構函式</title><link>https://zh-blog.logan.tw/2021/09/19/cxx-std-thread-destruct-before-join/</link><description>&lt;p&gt;前幾天在除錯的過程中，我注意到程式印出的 Stack Trace 和我的預期相去甚遠。在反覆研究之後，我發現一段有問題的程式碼。大 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 19 Sep 2021 21:31:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2021-09-19:/2021/09/19/cxx-std-thread-destruct-before-join/</guid><category>2021</category><category>cxx</category></item><item><title>C 語言的「四捨六入五成雙」</title><link>https://zh-blog.logan.tw/2020/11/22/c-round-even/</link><description>&lt;p&gt;最近在編寫單元測試的時候，我需要一個將浮點數「四捨六入五成雙」的函式。一開始我想：這很容易：只要把整數部分和小數 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 22 Nov 2020 23:24:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-11-22:/2020/11/22/c-round-even/</guid><category>2020</category><category>c</category></item><item><title>C++ 17 對例外處理規格的改動</title><link>https://zh-blog.logan.tw/2020/07/27/cxx-17-changes-to-exception-specification/</link><description>&lt;p&gt;今天我想要介紹 C++ 17 對「&lt;strong&gt;例外處理規格（Exception Specification）&lt;/strong&gt;」的二個改動：&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;移除 &lt;code&gt;throw (ClassName)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;將 &lt;code&gt;noexcept&lt;/code&gt; 納入型別系統（Type System）&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="section" id="throw-classname"&gt;
&lt;h2&gt;移除 throw (ClassName) 例外處理規格&lt;/h2&gt;
&lt;p&gt;在 C++ 98 …&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 27 Jul 2020 23:29:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-07-27:/2020/07/27/cxx-17-changes-to-exception-specification/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 fallthrough、nodiscard、maybe_unused 屬性</title><link>https://zh-blog.logan.tw/2020/07/19/cxx-17-fallthrough-nodiscard-maybe-unused-attribute/</link><description>&lt;p&gt;C++ 17 新增三個標準屬性（Attribute）：&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#fallthrough"&gt;[[fallthrough]]&lt;/a&gt; 用以標記接續執行下一個 switch case 的意圖。&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#nodiscard"&gt;[[nodiscard]]&lt;/a&gt; 用以提醒函式呼叫者檢查回傳值。&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#maybe-unused"&gt;[[maybe_unused]]&lt;/a&gt; 用以標記可能 …&lt;/li&gt;&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 19 Jul 2020 23:59:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-07-19:/2020/07/19/cxx-17-fallthrough-nodiscard-maybe-unused-attribute/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 template &lt;auto&gt; 非型別樣版參數型別推導</title><link>https://zh-blog.logan.tw/2020/07/12/cxx-17-template-auto-non-type-template-parameter-type-deduction/</link><description>&lt;p&gt;在 C++ 17 標準下，我們能以 &lt;code&gt;auto&lt;/code&gt; 關鍵字宣告非型別樣版參數（Non-Type Template Argument）。編譯器會以「樣版的實際參數」推導「樣版參數」的型別：&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;auto&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Arg …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 12 Jul 2020 23:22:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-07-12:/2020/07/12/cxx-17-template-auto-non-type-template-parameter-type-deduction/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 __has_include 前置處理表達式</title><link>https://zh-blog.logan.tw/2020/07/05/cxx-17-has-include-expression/</link><description>&lt;p&gt;&lt;code&gt;__has_include&lt;/code&gt; 是 C++ 17 加進前置處理器（Preprocessor）的新功能。我們能以 &lt;code&gt;__has_include&lt;/code&gt; 表達式偵測某個標頭檔（Header File）是否存在。如果前置處理器能找到指定的 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 05 Jul 2020 22:42:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-07-05:/2020/07/05/cxx-17-has-include-expression/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 Inline Variable</title><link>https://zh-blog.logan.tw/2020/03/22/cxx-17-inline-variable/</link><description>&lt;p&gt;Inline Variable（內嵌變數）是 C++ 17 新增的功能。Inline Variable 與 Inline Function（內嵌函式）相似，&lt;strong&gt;能讓我們在多個 Translation Unit（編譯單元）定義同樣的變數&lt;/strong&gt;&lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt;。鏈結器（Linker …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 22 Mar 2020 23:45:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-03-22:/2020/03/22/cxx-17-inline-variable/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 constexpr 與 Lambda 表達式</title><link>https://zh-blog.logan.tw/2020/03/08/cxx-17-constexpr-and-lambda-expression/</link><description>&lt;p&gt;C++ 17 將 Lambda Expression 納入常數表達式（&lt;code&gt;constexpr&lt;/code&gt;）的範疇，所以我們也能在只接受編譯期常數的地方呼叫 Lambda Expression 定義的 Lambda Function：&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;auto&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[](&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 08 Mar 2020 23:40:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-03-08:/2020/03/08/cxx-17-constexpr-and-lambda-expression/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 在 Lambda Expression 捕捉 *this</title><link>https://zh-blog.logan.tw/2020/02/17/cxx-17-lambda-expression-capture-dereferenced-this/</link><description>&lt;p&gt;如果一個成員函式（Member Function）有 Lambda Expression 而且該 Lambda Expression 有指定預設補捉模式（不論是傳值或傳參考）。當 Lambda Expression 內有程式碼指稱「成員函式 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 17 Feb 2020 22:34:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-02-17:/2020/02/17/cxx-17-lambda-expression-capture-dereferenced-this/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 if constexpr 述句</title><link>https://zh-blog.logan.tw/2020/02/10/cxx-17-if-constexpr-statement/</link><description>&lt;p&gt;C++ 17 新增的 if constexpr 述句能讓我們用更簡潔的方式編寫樣版特化（Template Specialization）。本文會介紹它的語法與應用。&lt;/p&gt;
&lt;div class="section" id="section-1"&gt;
&lt;h2&gt;語法&lt;/h2&gt;
&lt;p&gt;if constexpr 述句的語法與 …&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 10 Feb 2020 23:54:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-02-10:/2020/02/10/cxx-17-if-constexpr-statement/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 類別樣版參數推導</title><link>https://zh-blog.logan.tw/2020/02/02/cxx-17-class-template-argument-deduction/</link><description>&lt;p&gt;今天我想要介紹 C++ 17 的&lt;strong&gt;類別樣版參數推導（Class Template Argument Deduction）&lt;/strong&gt;。在 C++ 17 之前，樣版參數推導（Template Argument Deduction）只會被施行於「函式樣版（Function Template）」。以 &lt;code&gt;std …&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 02 Feb 2020 23:22:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2020-02-02:/2020/02/02/cxx-17-class-template-argument-deduction/</guid><category>2020</category><category>cxx</category></item><item><title>C++ 17 折疊表達式</title><link>https://zh-blog.logan.tw/2019/12/31/cxx-17-folding-expression/</link><description>&lt;p&gt;C++ 11 引入了 &lt;strong&gt;Variadic Template&lt;/strong&gt;，讓我們得以宣告任意個數的樣版參數。C++ 標準函式庫的 &lt;code&gt;std::make_tuple&lt;/code&gt; 就是一個典型的例子：&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;tuple&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;auto&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;make_tuple&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;a …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 31 Dec 2019 22:51:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-12-31:/2019/12/31/cxx-17-folding-expression/</guid><category>2019</category><category>cxx</category></item><item><title>C++ 17 選擇述句與初始化述句</title><link>https://zh-blog.logan.tw/2019/12/22/cxx-17-selection-statement-and-initializer/</link><description>&lt;p&gt;C++ 98 程式語言標準將 if、switch、while 與 for 述句的文法依序定義為：&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="line-block"&gt;
&lt;div class="line"&gt;&lt;strong&gt;if&lt;/strong&gt; (&lt;em&gt;condition&lt;/em&gt;) &lt;em&gt;statement&lt;/em&gt;&lt;/div&gt;
&lt;div class="line"&gt;&lt;strong&gt;if&lt;/strong&gt; (&lt;em&gt;condition&lt;/em&gt;) &lt;em&gt;statement&lt;/em&gt; &lt;strong&gt;else&lt;/strong&gt; &lt;em&gt;statement&lt;/em&gt;&lt;/div&gt;
&lt;div class="line"&gt;&lt;strong&gt;switch&lt;/strong&gt; (&lt;em&gt;condition&lt;/em&gt;) &lt;em&gt;statement&lt;/em&gt;&lt;/div&gt;
&lt;div class="line"&gt;&lt;strong&gt;while&lt;/strong&gt; (&lt;em&gt;condition&lt;/em&gt;) &lt;em&gt;statement&lt;/em&gt;&lt;/div&gt;
&lt;div class="line"&gt;&lt;strong&gt;for&lt;/strong&gt; (&lt;em&gt;for-init-statement&lt;/em&gt; &lt;em&gt;condition&lt;/em&gt;&lt;sub&gt;opt&lt;/sub&gt;; &lt;em&gt;expression&lt;/em&gt;) &lt;em&gt;statement&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;其中，我們能在 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 22 Dec 2019 15:11:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-12-22:/2019/12/22/cxx-17-selection-statement-and-initializer/</guid><category>2019</category><category>cxx</category><category>thread</category></item><item><title>C++ 17: 以 std::scoped_lock 避免 Dead Lock</title><link>https://zh-blog.logan.tw/2019/11/25/cxx-17-prevent-dead-lock-with-scoped-lock/</link><description>&lt;p&gt;最佳化多執行緒程式時，為了&lt;strong&gt;減少非必要阻塞（Blocking）&lt;/strong&gt;，常見作法是&lt;strong&gt;將一個 Mutex 依照保護對象拆分為多個 Mutex&lt;/strong&gt;。如此一來，一個執行緒 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 25 Nov 2019 23:44:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-11-25:/2019/11/25/cxx-17-prevent-dead-lock-with-scoped-lock/</guid><category>2019</category><category>cxx</category><category>thread</category></item><item><title>C++ 17 結構化綁定</title><link>https://zh-blog.logan.tw/2019/10/29/cxx-17-structured-binding/</link><description>&lt;p&gt;今天我想要介紹 C++ 17 新增的 &lt;strong&gt;Structured Binding（結構化綁定）&lt;/strong&gt;。以 &lt;code&gt;std::pair&lt;/code&gt; 為例，Structured Binding 能讓我們能直接將 &lt;code&gt;std::pair&lt;/code&gt; 的內容綁定到我們指定的識別字 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 29 Oct 2019 21:53:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-10-29:/2019/10/29/cxx-17-structured-binding/</guid><category>2019</category><category>cxx</category></item><item><title>漫談 C/C++ 巨集展開規則</title><link>https://zh-blog.logan.tw/2019/10/13/a-few-findings-on-c-macro/</link><description>&lt;p&gt;最近工作上遇到一個和 C/C++ 巨集有關的問題。我想要使用巨集將原本呼叫 &lt;code&gt;bcopy&lt;/code&gt; 的程式碼導向另一個實作 &lt;code&gt;__bionic_bcopy&lt;/code&gt;。所以我寫出以 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 13 Oct 2019 21:01:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-10-13:/2019/10/13/a-few-findings-on-c-macro/</guid><category>2019</category><category>c</category><category>cpp</category></item><item><title>簡介 perf_events 與 Call Graph</title><link>https://zh-blog.logan.tw/2019/10/06/intro-to-perf-events-and-call-graph/</link><description>&lt;p&gt;Call Graph 是幫助 Perf Events 使用者判讀效能瓶頸成因的重要工具。Call Graph 優雅地結合「&lt;strong&gt;花去最多執行時間的熱區&lt;/strong&gt;」與「&lt;strong&gt;為什麼要執行熱區 …&lt;/strong&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 06 Oct 2019 17:31:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-10-06:/2019/10/06/intro-to-perf-events-and-call-graph/</guid><category>2019</category><category>performance</category><category>linux</category><category>flamegraph</category></item><item><title>使用 perf_events 分析程式效能</title><link>https://zh-blog.logan.tw/2019/07/10/analyze-program-performance-with-perf-events/</link><description>&lt;p&gt;在最佳化程式之前，我們必須要先測量程式的執行狀況，如此我們才能對症下藥。本文要介紹 Linux 核心內建的系統效能分析 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 10 Jul 2019 23:31:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-07-10:/2019/07/10/analyze-program-performance-with-perf-events/</guid><category>2019</category><category>performance</category><category>linux</category></item><item><title>The Case of the Missing Supercomputer Performance 心得</title><link>https://zh-blog.logan.tw/2019/06/11/the-case-of-the-missing-supercomputer-performance-critique/</link><description>&lt;p&gt;因為最近的工作需求，我開始學習與補強系統效能分析方面的知識。所以我把同事之前推薦的論文 &lt;a class="reference external" href="http://library.lanl.gov/cgi-bin/getfile?01045303.pdf"&gt;The Case of the Missing Supercomputer Performance&lt;/a&gt; [Fabrizio Petrini …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 11 Jun 2019 21:01:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-06-11:/2019/06/11/the-case-of-the-missing-supercomputer-performance-critique/</guid><category>2019</category><category>performance</category></item><item><title>簡介 Sparse Set</title><link>https://zh-blog.logan.tw/2019/04/06/intro-to-sparseset/</link><description>&lt;p&gt;最近讀一些論文的時候，學到 Sparse Set 資料結構。我覺得這個資料結構的設計還蠻有趣的，所以花一點時間把他記錄下來。&lt;/p&gt;
&lt;p&gt;Sparse Set …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 06 Apr 2019 20:45:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-04-06:/2019/04/06/intro-to-sparseset/</guid><category>2019</category><category>algorithm</category></item><item><title>Python3: 淺談 Python 3.3 的 Yield From 表達式</title><link>https://zh-blog.logan.tw/2019/03/30/python3-intro-to-yield-from-expr/</link><description>&lt;p&gt;我最近需要使用 Python 2.7 解開 zip 壓縮檔並分析檔案內容。所以我寫了下面的程式。然而這個程式是有問題的。它沒有辦法列 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 30 Mar 2019 09:33:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-03-30:/2019/03/30/python3-intro-to-yield-from-expr/</guid><category>2019</category><category>python</category></item><item><title>Python: defaultdict 的陷阱</title><link>https://zh-blog.logan.tw/2019/01/27/python-a-pitfall-of-defaultdict/</link><description>&lt;p&gt;最近壓力比較大，讓我出賣一下我的同事。&lt;/p&gt;
&lt;p&gt;我的同事 L 最近要用 Python 寫一個函式 &lt;code&gt;lookup()&lt;/code&gt;。它會拿三個參數：&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;d&lt;/code&gt;：一個 &lt;code&gt;str&lt;/code&gt; 到 &lt;code&gt;set&lt;/code&gt; 的 &lt;code&gt;dict&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;x&lt;/code&gt;：當 …&lt;/li&gt;&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 27 Jan 2019 20:11:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-01-27:/2019/01/27/python-a-pitfall-of-defaultdict/</guid><category>2019</category><category>python</category></item><item><title>C++17: string_view、map 與異質比較查詢</title><link>https://zh-blog.logan.tw/2019/01/23/cxx17-string-view-map-and-heterogeneous-comparison-lookup/</link><description>&lt;p&gt;身為一個 C++ 程序員，我都會盡我所能避免不必要的計算。所以當我聽到 C++ 17 新增了 &lt;code&gt;std::string_view&lt;/code&gt; 類別，我就迫不及待的想要使用它 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 23 Jan 2019 22:58:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2019-01-23:/2019/01/23/cxx17-string-view-map-and-heterogeneous-comparison-lookup/</guid><category>2019</category><category>cxx</category></item><item><title>一個 Undefined Behavior 的故事</title><link>https://zh-blog.logan.tw/2018/01/19/a-tale-of-undefined-behavior/</link><description>&lt;p&gt;L 開完會，想要去吃晚餐的時候，忽然被 A 叫住：你能來看一個 X 公司發過來的 Issue 嗎？這有點急。&lt;/p&gt;
&lt;p&gt;問題是這樣的：下面這段代碼 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Fri, 19 Jan 2018 22:01:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2018-01-19:/2018/01/19/a-tale-of-undefined-behavior/</guid><category>2018</category><category>cxx</category></item><item><title>Python: 簡介 weakref.finalize</title><link>https://zh-blog.logan.tw/2017/02/23/python-intro-to-weakref-finalize/</link><description>&lt;p&gt;如果我們要讓一個物件持有一些資源，然後希望這個物件被回收的時候釋放它持有的資源，我們該怎麼撰寫這個類別呢 …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Thu, 23 Feb 2017 20:39:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2017-02-23:/2017/02/23/python-intro-to-weakref-finalize/</guid><category>2017</category><category>python</category></item><item><title>Python 3: 簡介 Raise From 述句</title><link>https://zh-blog.logan.tw/2017/01/14/python3-intro-to-raise-from-stmt/</link><description>&lt;p&gt;今天要介紹 Python 3 引入的  &lt;code&gt;raise ... from ...&lt;/code&gt; 述句。相信大家都知道 &lt;code&gt;raise&lt;/code&gt; 述句是用來拋出一個例外。那 &lt;code&gt;raise ... from ...&lt;/code&gt; 述句有何不同呢？&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/usr/bin/env python3&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;traceback&lt;/span&gt;

&lt;span class="k"&gt;class …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 14 Jan 2017 22:22:00 +0800</pubDate><guid isPermaLink="false">tag:zh-blog.logan.tw,2017-01-14:/2017/01/14/python3-intro-to-raise-from-stmt/</guid><category>2017</category><category>python</category></item></channel></rss>