Lesson 0: Why C++ at All?
In earlier C lessons you saw how such a language gives full control over memory and hardware — at a price: any large codebase becomes a manual effort to maintain, with no classes, no templates, no tools to organize it all. So why add another language, C++, that sounds even more complicated? Because
C++ is like C with an organizing toolkit: the same precise control over memory and timing, plus a way to build large systems without the code turning into a mess.
- garbage collection (GC)
- An automatic mechanism that frees memory no longer in use, but may pause the program for an unpredictable duration to perform the cleanup.
- real-time constraint
- A requirement that an operation finishes within a fixed, known time window — for example, drawing a frame every 16 milliseconds to hold 60 frames per second.
- manual memory control
- The ability to decide precisely when memory is allocated and when it is released, without relying on an unpredictable background process.
- abstraction at scale
- Tools for organizing large code — classes, templates, and the STL — that let you build complex systems without losing control over performance.