csst
資料有重量,不信的話把硬碟拿掉看電腦會不會變輕
記憶體 (RAM) | 硬碟 (HDD, SSD) | |
---|---|---|
用途 | 快速讀寫資料 | 長期儲存資料 |
關機後資料 | 消失 | 還在 |
存取速度 | 快 | 慢 (SSD > HDD) |
舉例 | 書桌 | 書櫃 |
#include <stdio.h> #define BANG(x) printf(x) int main() { /* Hello World! */ BANG("Hello World!\n"); return 0; }
gcc -E -ansi hello.c
# 874 "/usr/include/stdio.h" 3 4 # 3 "hello.c" int main() { printf("Hello World!\n"); return 0; }
gcc -S -ansi hello.c
_main: ## @main
.cfi_startproc
## %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
subq $16, %rsp
movl $0, -4(%rbp)
leaq L_.str(%rip), %rdi
movb $0, %al
callq _printf
xorl %ecx, %ecx
movl %eax, -8(%rbp) ## 4-byte Spill
movl %ecx, %eax
addq $16, %rsp
popq %rbp
retq
.cfi_endproc
## -- End function
.section __TEXT,__cstring,cstring_literals
L_.str: ## @.str
.asciz "Hello World!\n"
將組合語言轉成目標檔案 (object file) : 機器碼 / binary
0101010101
將目標檔案 (object file) 與標頭檔等其他檔案連結起來,產生可執行檔