by SuperV1234 · 1y ago · 0 comments
C++ is fine, but it's insanely slow to compile.
I generally like C++, but I could trade anything to make it faster to compile, and most of the time, I just use a small subset of C++ that I feel okay with.
Modules support was added recently, and I don't think most libraries or cmake support it yet, and I don't really see tutorial about good practices for modules, especially when it comes down to speeding up compilation.
Also modules do not really speed up compilation that much, apparently, or I have not seen benchmarks, maybe because modules are not well supported yet?
Modules are great in theory, but I am not sure they are usable in 100% of cases, especially with all the existing code that is out there?
PImpl doesn't need to have a performance hit as you can implement it with a local fixed-sized buffer that's not heap-allocated.
You can also design your C++ codebase exactly as you would in C, so there's literally no reason why you'll need to recompile more in one language compared to the other.
There are definitely advantages to simpler tools, you can streamline development and make people more productive quicker. Compare that scenario to C++ where you first have to agree the features you're allowing and then have to police that subset throughout on every PR.
Personally when I initially learned C++ back in 1993, with Turbo C++ 1.0 for MS-DOS, I hardly saw a reason to further use C instead C++, other than being required to do so.
Unfortunately adhering to modern tooling is always a quixotic battle, even when they come for free on modern FOSS compilers.