From C++ Source Code to Execution
What Happens at Every Stage
From C++ Source Code to Execution: What Happens at Every Stage
#include <iostream>
#define PI 3.14
int square(int x) {
return x * x;
}
int main() {
int a = 5;
std::cout << square(a) << std::endl;
}The Complete Pipeline
Stage 1 - Preprocessing
What is the Preprocessor?
Header Expansion
Comment Removal
Conditional Compilation
Output
Important
Stage 2 - Compilation
Parsing
Semantic Analysis
Optimization
Code Generation
Output
Stage 3 - Assembly
The Object File
.text
.data
.bss
.rodata
Symbols
Stage 4 - Linking
Static vs Dynamic Linking
Libraries
Relocation
Output
Stage 5 - Program Execution
The Loader
Runtime Initialization
CPU Execution
Putting Everything Together
Why This Matters
Stage
Why It Matters
PreviousExperiments Don’t Just Build Skills. They Build PerspectiveNextYou are on defence. Why do you need access to Sentry?
Last updated