<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>C - 標籤 - Yan-Hao Wang&#39;s Blog</title>
        <link>https://kola.ink/tags/c/</link>
        <description>C - 標籤 - Yan-Hao Wang&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator><language>zh-TW</language><managingEditor>bses30074@gmail.com (Yan-Hao Wang)</managingEditor>
            <webMaster>bses30074@gmail.com (Yan-Hao Wang)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Sun, 07 Jun 2026 22:00:52 &#43;0800</lastBuildDate><atom:link href="https://kola.ink/tags/c/" rel="self" type="application/rss+xml" /><item>
    <title>OS ABI 了解</title>
    <link>https://kola.ink/os-abi/</link>
    <pubDate>Sun, 07 Jun 2026 22:00:52 &#43;0800</pubDate>
    <author>bses30074@gmail.com (Yan-Hao Wang)</author>
    <guid>https://kola.ink/os-abi/</guid>
    <description><![CDATA[<h2 id="簡介">簡介</h2>
<p>常常說 ABI 是已經編譯好的程式和 OS 之間的介面規範，他規定的是 Binary 層級怎麼互動的。</p>
<p>根據 <a href="https://wiki.osdev.org/System_V_ABI" target="_blank" rel="noopener noreffer ">System V ABI</a>，像是：</p>
<ul>
<li>Calling Convention
<ul>
<li>函式參數放在 stack/register</li>
<li>Return value 放哪裡</li>
<li>Stack frame layout</li>
<li>CPU 執行函式只是跳到某個函式第一個 instruction，編譯器產生的機器碼負責把第一個參數放在 stack/register</li>
</ul>
</li>
<li>System Call Interface</li>
<li>直接定義 Bianry Format，System V ABI 使用 ELF</li>
<li>Dynamic Linking 的規則</li>
<li>資料類型的大小</li>
</ul>
<p>最常見的就是以 C 的 ABI，C++ ABI 則複雜一點。</p>]]></description>
</item>
<item>
    <title>Compiler, Assembler and Interpreter 了解</title>
    <link>https://kola.ink/compiler-interpreter-vm/</link>
    <pubDate>Fri, 01 May 2026 15:30:49 &#43;0800</pubDate>
    <author>bses30074@gmail.com (Yan-Hao Wang)</author>
    <guid>https://kola.ink/compiler-interpreter-vm/</guid>
    <description><![CDATA[<h2 id="c-語言">C 語言</h2>
<p>Preprocessing: 預處理，把程式碼所有用 # 開頭的指令進行替換</p>
<ol>
<li>C ISO 標準定義，所謂的 翻譯階段 (Phases of Translation)。C 語言的編譯過程在標準中被拆解為 8 個邏輯階段，而「預處理」主要涵蓋了前 4 個階段
<ol>
<li>Phase 1-3： 處理字元映射、將連行符號（\）合併、把註解換成空格</li>
<li>Phase 4： 執行所有 預處理指令（也就是你看到的 # 開頭的東西）並進行 巨集展開 (Macro Expansion)。</li>
</ol>
</li>
</ol>
<p>最後產出了 <code>.i</code> 檔案，可以參考<a href="https://blog.yurich.me/posts/translation-phases-in-c/" target="_blank" rel="noopener noreffer ">C语言的翻译阶段</a>。</p>]]></description>
</item>
</channel>
</rss>
