---
# System prepended metadata

title: C99 - 5. Environment

---

# C99 - 5. Environment
[TOC]
#### 5.1.1.1 Program structure
前置處理器
- Definition
	- in **C99**, 
	    - [5.1.1.1 Program structure p1](http://port70.net/~nsz/c/c99/n1256.html#5.1.1.1p1):
	      A C program ==need not== all be translated at the same time.
          The text of the program is kept in units called source files, (or preprocessing files) in this International Standard.
          > 在ISO, 程式的文本是由`source file` (or `preprocessing file`)為單位所組成。
          
	      A source file together with all the headers and source files included via ++the preprocessing directive++ **#include** is known as a *preprocessing translation unit*. After preprocessing, a preprocessing translation unit is called a translation unit.
	      > 一個source file是透過preprocessing directive `#` 將其從preprocessing translation unit 轉譯成 *translation unit*
          
          :notes: 綜合上述兩個註解；translation unit為一個source file, 且包含透過[前置處理導引；前置處理器指示](https://terms.naer.edu.tw/detail/18111336/?index=1)將外在宣告（`External Declaration`），headers和source files包含進來。包含進來的方式有：
          - 動態連結：在程式執行時，到對應的記憶體位置找對應的指令(利用symbol table)。
          - 靜態連結：做preprocessing時，透過`#include` directive將`header`的內容貼到translation unit中。

- History
  在ISO C之前早期的C 語言編譯器, 發展於1972-1973 年間，被稱為 “Very early C compilers” 的實作中，不存在 C preprocessor (!)
  > 摘錄自：[你所不知道的 C 語言：前置處理器應用篇 - 前置處理器是後來才納入 C 語言的特徵](https://hackmd.io/@sysprog/c-preprocessor?type=view#%E5%89%8D%E7%BD%AE%E8%99%95%E7%90%86%E5%99%A8%E6%98%AF%E5%BE%8C%E4%BE%86%E6%89%8D%E7%B4%8D%E5%85%A5-C-%E8%AA%9E%E8%A8%80%E7%9A%84%E7%89%B9%E5%BE%B5)