The supplied C++ docset comes from cppreference.com and is very, very useful to have to hand.
The Python and CMake docsets are also particularly useful to me.
C++ really has a lot of good things. It's just a shame it's so slow to compile.
I'm curious if anybody is working to make C++ faster to compile. Even if it was a subset of the language, with some features removed, it would be good enough for me.
Yes - C++20 added support for modules to the Core Language (both "header units" and "named modules"; header units are an intermediate step between classic includes and named modules), and support for header units to the Standard Library. Compiler/library support is a work in progress (MSVC's STL, which I work on, is the furthest along - see https://github.com/microsoft/STL/issues/1694 for status), but header units are showing significant improvements in compiler throughput (build speed). This looks like `import <vector>;` in your source code (with significant build system changes to build vector as a header unit, producing vector.ifc and vector.obj).
There's a proposal under review for C++23 to add named modules for the Standard Library, see https://wg21.link/p2465r2 . If this is accepted, `import std;` (or `import std.compat;`) will be the one-line way to use the entire C++ Standard Library with (what we hope will be) even better compiler throughput.
The primary limitation of header units and especially named modules is macros: neither can be influenced by macros defined in the source file, and named modules can't emit macros at all. Thus, one will still need to `#include <cassert>` in addition to `import std;` if you want the `assert()` macro.
Currently it appears anyone that cares about bounds checking and iterator validation in release builds, has to keep using global module fragments.
The standard library modules really need to be built as part of your projects build so that you can compile them however you want.
How hard will it for library writers to supply their libraries as modules?
Will the only requirement be to remove macros?
* Use ninja instead of make
* Use PCH
* -gsplit-dwarf
IME, the single best way to reduce your C++ compile times is to compile less code:
* Remove all unnecessary headers. Template expansion is slow, and preprocessing is even slower. Some of the standard includes (like `<regex>` and `<iostream>`) are notorious for slowing individual translation units to a crawl. `#pragma once` for your own headers also helps with cpp-time performance.
* Forward-declare as much as you can. Forward type declarations mean that the compiler doesn't need to process all of `Foo` when it sees `Foo&` or `Foo`.
Use pImpl wherever you can (and makes sense). Private implementations similarly reduce the amount of code the compiler needs to analyze.
For better or worse, the current winds suggest that C++ compilation times will only continue to get worse (more constexpr/consteval, even more complex templating features/concepts, etc.).
Substantial improvement in compilation speed might depend on use of JIT techniques, running generated code in the compiler to perform template evaluation. I.e., a template is not just a data structure, it is a compile-time function that, where used much, is compiled to optimized machine code, its run-time values being what we think of as types. Thus far, all these functions are run like an interpreter walking a syntax tree.
Precompiled headers, or module intermediate files, could have this code in them already optimized.
Also, my understanding is that, except for the very first few prototypes, starting from cfront on the C++ compiler was a real compiler. It just happened to target C instead of asm.
The tuple drawing is also somewhat misleading, because the first box (int) should be the same size as the second one (double), due to alignment.
Sometimes you just in that hole and it is hard between the gap of knowing or trained on the basic c++ and then need to or try to understand a c++ …
Or JavaScript.
If I had one thing I could have added to it: panel for understanding value categories[0] -- I have an incredibly hard time wrapping my head around how they're described. I attribute the difficulty to the cpp standard being excruciatingly complex, the language itself not being designed holistically, and backwards compatibility with itself and C.
[0] https://en.cppreference.com/w/cpp/language/value_category
In practice it boils down to "if it has a name, you need to std::move it to get move semantics, otherwise you don't". Caveats apply (e.g. returning a named value).
C++ is a very error prone, complex and risky language and even when used in industry, it's used in such a way that companies significantly restrict its feature set to a mostly sane subset of the language that in many cases looks like a dialect of C with classes. The benefit of using it is your product has the potential to outperform software written in other languages, but this benefit often comes at the cost of software that is more limited in features compared to competitors.
For some domains, like HFT, audio and graphics, where performance is the primary feature C++ does pay well, but for most other domains the sheer complexity of the language outweighs any benefit to productivity.
So ultimately the reason Python developers get paid more than C++ developers is because products developed in Python are more productive than products developed in C++. The reason for that difference in productivity is that given two developers who are both investing X units of time working a product, the Python developer is far more likely to spend that time adding new features to their product while the C++ developer is likely to spend that time trying to find the cause of some random bug due to undefined behavior, or trying to figure out some arcane and complex language quirk.
The highest-paid programming jobs are mainly held by C++ programmers, many of them in service of financial gambling. That work shades over into FPGA and HPC programming at the high end. A skilled C++ programmer at these shops can get a half $million, some more.
You are certainly acquaited with it.
FAANG and FAANG-adjacent companies will pay way more than that for a senior C++ developer in London (they will also pay more for a web developer).
And of course there is the City.
The actual salaries are unfortunately usually not advertised.
All documentation would be so much better if it came with cheatsheets you could quickly scan for things that you might need.
I wonder why they are so rare...
Thanks for putting in all the hard work and sharing with the community.