C++ Cheat Sheets
21–30 of 82 posts
Re: C++ Cheat Sheets
#22Wow, this is really good, there are still things I can learn. 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.
Re: C++ Cheat Sheets
#23Earlier quoted context omitted.
CLion from JetBrains and Microsoft Visual Code are the best commercial ones for Linux, NetBeans is a free (as in freedeom and open source) one (that also supports many other languages like Java and Python). What I don't recommend is Eclipse - it's complex and confusing for beginners (but a bit faster than some others).
I didn’t think NetBeans supported C++ anymore?
* https://github.com/apache/netbeans/tree/12.3/cpplite#cpplite
* https://github.com/apache/netbeans/blob/12.3/cpplite/cpplite...
Re: C++ Cheat Sheets
#24Earlier quoted context omitted.
Off topic. Could you recommend an ide to work with c++?
Microsoft Visual Studio for Windows and QtCreator for Linux.
Oh and of course compile errors are absolutely useless but I suppose that's a C++ thing in general. The error panel shows the (last? First?) Error in a chain of errors, which is always something deep in library code. E.g. accidentally tried to copy a non-copyable object using unique_ptr? You can't find the offending callsite, it just points you to xmemory and at best the class being wrongly used.
Re: C++ Cheat Sheets
#25Re: C++ Cheat Sheets
#26If 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
Re: C++ Cheat Sheets
#27Re: C++ Cheat Sheets
#28This is quite something! I intend to share w/ my coworkers :) 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:/…
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).
Re: C++ Cheat Sheets
#29Wow, this is really good, there are still things I can learn. 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 ;` 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 ` in addition to `import std;` if you want the `assert()` macro.
Re: C++ Cheat Sheets
#30This is quite something! I intend to share w/ my coworkers :) 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:/…