Two tiny files, main.c and square.c, followed through five machines until the screen says 25. Every byte, address and message on the board came from a real gcc 13.3 run on Linux x86-64.
Step through with Next, or press Play. With sound on, a voice reads each step. When a red box asks you to predict, pick an answer before you move on. Click a machine on the board to jump to it.
The same board, narrated end to end, about eight and a half minutes. The film matches the look you picked above when one exists; otherwise pick one here. Captions are on the CC button.
The same journey told a different way: a hand-drawn conveyor belt, a different little program (main.c with mathx.h and an add function), and a quicker pass through the flags. About five minutes. Watch it before or after the board.
Film by Kai Mori Video Pipeline.
Name the machine first. The fix depends on it.
| Want to | Flag | Real result here |
|---|---|---|
| Stop after copy, compile or assemble | -E -S -c | main.i (825 lines), main.s, main.o (1,576 B) |
| Keep every middle file | -save-temps | left main.i, main.s, main.o |
| Name the output | -o app | without it: a.out |
| See the real commands | -v -### | cc1, as, collect2 (calls ld) |
| Headers, macros, libraries | -I -D N=7 -L. -lsq | libraries go after the files that use them |
| Warnings | -Wall -Wextra -Wshadow -Wconversion | 103, 156, 172 warnings on, by level |
| Warnings as errors | -Werror -Werror=format | exit 1, no binary written |
| Language version | -std=c17 -std=c++17 | defaults: gnu17 and gnu++17 |
| Speed or debugging | -O0 -Og -O2 -O3 -Os -g | -g: 16,024 to 17,688 B |
| Catch memory and UB bugs | -fsanitize=address,undefined | stack-buffer-overflow at ub.c:6 |
| Library type | -static -shared -fPIC | 785,392 B static |
Practice: slow, loud, catches the off-by-one.
What a judge usually runs.
main.c and square.c disagree about what square is:
// main.c // square.c
int square(int); double square(double x) { return x * x; }
You build with gcc -Wall -Wextra main.c square.c -o app. Who catches the mismatch: the compiler, the linker, or nobody? Answer in the thread before you test it.