C, C++, Rust and Go
Level 3 · General-purpose and systems languages
Four systems languages that compile to fast machine code. Why C and C++ are everywhere, how Rust stops memory bugs, and what Go is built for.
Course contentsLesson 8 of 12
Level 1 · How languages differ
Level 2 · Languages of the web
Level 3 · General-purpose and systems languages
Level 4 · Languages for phones
Level 5 · Data and functional languages
Level 6 · Scripting languages
After this lesson you can
- Say why C and C++ are used for speed
- Explain the memory bugs Rust prevents
- Say what kind of program Go is good for
13 mincovers 4 glossary entries
Worth reading first: Compilers and Interpreters
Which languages run close to the machine
Systems languages compile to machine code and run close to the hardware. They are used where speed and control matter most: operating systems, browsers, games and databases. C, C++, Rust and Go are the four main ones. All four are compiled and statically typed.
C was made in 1972 at a phone company's lab, and much of the world's core code is still written in it. The core of Linux, most operating systems and countless small devices run C. It is small and fast, and it lets you manage memory by hand. That power is also its danger: write past the end of a list, and C does not stop you.
C++ grew out of C and added classes and much more. It keeps C's speed and adds tools for building very large programs. Big games, game engines and web browsers are mostly C++. It is huge and takes years to master.
Rust aims for the speed of C and C++ without their memory bugs. Its compiler checks who owns each piece of memory, and it refuses to build code that could write past the end or use memory after it is freed. Version 1.0 came out in 2015. Since late 2022, parts of Linux can be written in it.
Go comes from Google and was announced in 2009. It is kept deliberately simple, with a small set of features, and it builds quickly. It is good at servers that juggle many jobs at once. Docker and Kubernetes, two tools that run much of the cloud, are written in Go.
Which to learn? C to understand how the machine really works. C++ for games and engines. Rust for new code that must be fast and safe. Go for servers and command-line tools that a team must read and change easily.
People often think low-level code is always faster. Go or Rust can match C in many jobs. A careful Python program that calls fast code can be quick enough. Pick a systems language when you know speed matters, not out of habit.
Four systems languages
Worked example
Jack's team rewrites one slow part
Jack's Python service resizes photos, and one step takes 900 milliseconds per photo. The rest of the service is fine.
The team rewrites only that step in Rust and calls it from Python. It now takes 60 milliseconds, and the other 95% of the code stays in Python.
The words for this lesson4
Check yourself
What is Rust best known for?
Finished this lesson?
Marking it complete also marks its 4 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.