Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Chapter 0

Before you start: programs, just enough C++, and the terminal

Four boxes left to right. A file called add.cpp holding a one-line C++ piece of code that adds two numbers; an arrow into a compiler box marked clang++; an arrow into a box of machine code holding the numbers 141 4 55 195, noted as what the processor actually runs; and a text window where ./add printed 2 + 3 = 5. A note underneath says the machine code was captured from clang -O1 for x86-64 Linux and is shown in decimal.
One line of C++, and the four numbers the processor actually follows.

Four Numbers Under Every Program

Write return a + b; in C++ and give it to a compiler. With its optimizer switched on, what comes out for the processor in a typical Linux PC is four numbers: 141, 4, 55, 195. That's the whole of it. The processor never sees your names, your plus sign or your semicolon, only numbers like these, one small step after another. This course is about those numbers: where they come from, what they mean on three different families of processor, and why the same C++ can become very different machine code.

You don't need to have studied any of this before. You do need a little C++ and a way to build and run a program, and this chapter supplies both, whether you come from C++, C#, Java or Python.

The first section separates source code, the text you write, from machine code, the numbers the processor follows. It also explains why a Java, C# or Python programmer has usually never seen the machine code of their own program. A compiler to bytecode, a virtual machine or an interpreter stood in between.

The next two sections teach just enough C++ to read every example in the book. The first covers whole numbers whose size is part of their name, arithmetic, decisions, loops, and reusable named pieces of code. The second covers rows of values, grouped values, and text. Each idea comes with a table showing how Java, C# and Python spell the same thing.

The fourth section opens the text window where you build programs by typing commands, on Windows, macOS or Linux, and builds and runs a small C++ program from it. The last section explains how the course itself works. It covers the two ways each idea is written and the caption on every listing. It also covers the three places code runs, from the outputs captured when the course was built to the labs you run on your own machine.

By the end you'll be able to read the C++ half of every example in this course, and build and run a program of your own. Chapter 1 then shows what happens to it on the way to those four numbers.

  • No matches.