C++20 and Apple Silicon

It's been about eight years since I last tried learning C++. The first time was in a classroom setting, and I struggled quite a bit to keep up. With the 3rd edition of "Programming: Principles and Practice" by Bjarne Stroustrup, I figured it was a good time to brush up on my skills and learn something new.

Stroustrup leans into the features of newer versions of C++, like modules from C++20 and the standard library module from C++23. In the "Hello, World!" example at the beginning, he uses import std; as the primary way of including the standard library and suggests using #include <iostream> only if you're not using a modern compiler that supports modules and the standard library module. Given that Stroustrup, the inventor of C++, is the one recommending this approach, I figured it would be the best way to start learning C++ again.

I tried compiling it on my M3 MacBook Pro but kept running into errors since Apple's Clang on Xcode 15 doesn't fully support many of the newer features. It doesn't look like Xcode 16's implementation will either. I spent the whole weekend reading up on compilers and tried to compile g++ myself to get the new modules to work, but getting it to work on Apple Silicon ended up being too much of a task for a novice like myself.

I begrudgingly ended up using #include <iostream>. As much as I want to follow Stroustrup's guidance and use the latest features, I'd rather not waste time and start going through the book. Maybe future releases of either clang or g++ will run on Apple Silicon with less friction, and I'll be able to use the new features. In the meantime, I'm excited to get back into programming and creating things again.