Open-Source Projects for Learning Modern C and C++
CMU Databases and QMK
Every now and then, I wonder “Is low-level programming still unpleasant?” Call it a morbid fascination, but I really did enjoy some aspects of working in C and C++; in particular, reasoning about low-level behaviour becomes a lot easier with fewer layers of abstraction on top of the metal. On the other hand: memory management and interoperability are hard, the C/C++ ecosystems have accumulated decades of cruft, and both languages are missing a lot of features that are now par for the course.
It turns out that the short answer is “No, because Rust is great”, but it’s still useful to get a feel for modern C and C++. Here are some projects and tools that I’ve found particularly indispensable for that.
Preface: Why Not Book Learnin'?
There are a lot of books out there that will teach you how to use newer C++ features. Effective Modern C++ is a popular one, but personally, that’s not what I’m looking for. I know that I learn best from hands-on experience, and so what I really wanted was to play with some decent-sized example projects using modern tooling.
CMU’s Research/Educational Databases for C++
I can’t say enough good things about CMU’s Database Group, and specifically professor Andy Pavlo’s work. CMU has 3 (yes, 3!) open source relational databases written in modern C++ on GitHub:
- BusTub, an educational system written for the Database Systems course
- Terrier, CMU’s current research database
- Peloton, CMU’s older research database
BusTub and Terrier use C++17, but Peloton uses C++11. I’d recommend BusTub and Terrier since they’re both under active development. Terrier has excellent documentation for getting up and running on the wiki. They recommend using CLion, a modern C/C++ IDE from JetBrains.
CMU’s even provided some small pieces of work to dip your toes in; the projects for the Database Systems course involve implementing basic functionality in BusTub, and grading scripts for the projects will be available soon.
Quantum Mechanical Keyboard Firmware (QMK)
I’m a bit of a keyboard dork, so of course I jumped at the chance to program my keyboard’s firmware.
QMK is a very popular open-source keyboard firmware project , mostly written in C. QMK’s documentation is outstanding, and will help you get up and running with hardly any fuss. I was able to implement a custom keymap in C in just a few hours, armed with only the C I remembered from school 10 years ago.