From 2d8f3f7863d0ba00b3ca8a588c4fd6ca0c86177a Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 23 Jun 2024 23:34:33 +0200 Subject: Published Where to Learn C++ --- where_to_learn_cxx.html | 216 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 where_to_learn_cxx.html (limited to 'where_to_learn_cxx.html') diff --git a/where_to_learn_cxx.html b/where_to_learn_cxx.html new file mode 100644 index 0000000..d299444 --- /dev/null +++ b/where_to_learn_cxx.html @@ -0,0 +1,216 @@ + + + + + + + + + + +Where to Learn C++ + +
+ + +

Where to Learn C++

+
+ +
+

This post is an attempt to list down resources I find interesting or useful for learning, polishing, debugging, +or exploring C++ programming language. It is unlikely to provide an exhaustive list and I don't necessarily intend to +create one. If you have any suggestions, I'm happy to read them. +

An alternative title would be: where to read about C++ or my links about C++. +

I organized this list into completely arbitrary items with no particular order. It is completely opinionated and each +item has a very short explanatory description, link, instruction, and/or any other reference. I swear there is a reason +for each entry... +

    +
  1. Literature +
  2. Standard References +
  3. Proposals +
  4. The Standard +
  5. Implementations +
  6. Headers +
  7. Source Code +
  8. Boost +
  9. Conferences +
  10. Core Guidelines +
  11. Code Style Guidelines +
  12. Interactive Exploration +
  13. Classes, Courses and Tutorials +
  14. Stack Overflow and LLMs +
+ + +

Literature

+

There are three books on C++ that are good enough to be excluded from my usual "ban on books about programming +languages, frameworks and libraries."

+book covers +

From left to right +

    +
  1. Effective Modern C++, Scott Meyers +
  2. The C++ Programming Language, Bjarne Stroustrup +
  3. C++ Primer, Stanley B. Lippman, Josée Lajole, Barbara E. Moo +
+

If you are beginning your programming journey, you have better chance of learning something if you use the books as +complementary resource to your class/course. If you are intermediate or higher, these books are good as "back-to-basics" +and to solidify your foundations. + + +

Standard References

+

These references explain C++ standard so that it can be consumed easier by language and library users. They may or +may not reference implementation-specific details. +

+

You are likely to use them the most compared to any other entry in this list. This is the case for me. +

Both of these sites are also designed to act as an index for other resources, including but not limited to, standard +compiler support matrices, tutorials, technical specifications, proposal or experimental references. If you never did, I +encourage you to grab something to drink and explore one of them a bit. + + +

Proposals

+

Proposals are my favourites. They are C++ standard committee papers that propose changes to the language or standard +library. Their goals are to present an idea in understandable way and reason it. Make it look like a good idea. This +part of their nature makes them often better to read than the actual C++ standard. This is especially evident when they +are coming from the outside of usual working group and/or compiler circles. +

You can find them at C++ Standards Committee +Papers index. +

Alternatively, if you are looking for proposal regarding a particular feature, you can: +

    +
  1. Go to cppreference.com. +
  2. Find applicable C++ standard revision, e.g., C++17. +
  3. + Find feature in one of the matrices, e.g., Structured Bindings and associated + P0217R3. +
  4. + P0217R3 describes wording changes but refers to P0144R2 as original + proposal. +
+ + +

The Standard

+

Also known as ISO/IEC 14882.

+c++ logo +

This is the primary source. Or rather the working draft of the primary source. Standard is intended to define +requirements for compiler and library implementations. It is not necessarily intended as your day-to-day reference +document. Nonetheless, it is useful because it can provide you with an authoritative answer. +

You can buy the actual standard revisions at the ISO Store. +

Draft is available at eel.is/c++draft. +

Standard C++ has a homepage at isocpp.org with a good amount of useful resources, +i.a., Get Started!, Tour, and Super-FAQ. + + +

Implementations

+

On the other side of the standard specifications are implementations of said requirements: compilers and standard +libraries. It is as awkward to split them into separate list items as it is to have them both here. I rely mostly on +standard specification and/or reference and use these from time to time, when I need to consult implementation-defined +behaviour or details, options, recommendations. +

+ + +

Headers

+

The gist of it is, know your include paths. For example to start with: +

    +
  1. /usr/include/c++/14.1.1 +
  2. /usr/include/c++/14.1.1/x86_64-pc-linux-gnu +
  3. /usr/include/c++/14.1.1/backward +
  4. /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include +
  5. /usr/local/include +
  6. /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include-fixed +
  7. /usr/include +
+

Of course, depending on your compiler, library provider and targets these will vary. Consult your compiler +documentation. +

They may feel hit-or-miss. It gets especially bad when dealing with multi-target back-compatible headers as they +quickly devolve into macro madness. Yet, they are your exact specification of what you are dealing with. + + +

Source Code

+

I like reading what others wrote. I don't really care if it is bad or not, because I can learn from it nonetheless +simply by asking a questions "why?" and "what does this excerpt exactly do?" +

Selected pieces of software (alphabetical order): +

+

In general, just take a look at whatever software you use. You might even end up contributing to it and that's always +good. + + +

Boost

+

I have a love-hate relationship with Boost. Nonetheless, its documentation has a number of good examples and +recommendations. Even if you don't plan using Boost, it may provide you with solution patterns. +

Docs version index is located at boost.org/doc. + + +

Conferences

+

I'm socially awkward but I do like to listen to knowledgeable people. Even better if I'm interested in the topic they +talk about. Isocpp.org maintains a list of worldwide +conferences. +

CppCon YouTube channel is probably the best place to start if you are +looking for talks. They have a large variety of them: deep dives, lightning talks, back to basics, etc. + + +

Core Guidelines

+

A document maintained by Bjarne Stroustrup and Herb Sutter with a whole lot of recommendations. It is available +online at C++ Core Guidelines. +

It's not necessary to read it like a book, but doing a full skim at least once would be beneficial to get an idea +when to refer to the guideline. Choosing a random topic and reading it on a coffee break is also an option. Whatever the +method - read it - it's good. + + +

Code Style Guidelines

+

Even if you work alone these can be useful as rules may prevent trivial errors and make the code more maintainable in +the long run. +

Examples of coding styles (alphabetical order): +

+ + +

Interactive Exploration

+

A good way to build intuition around C++ is to watch the tools do what they are intended to do and inspect the +results. An example of such tool is Compiler Explorer. +

We can get similar results in local environment. For example, we can make GCC emit assembly output with +-S flag. Another command, c++filt(1) can be used to demangle symbols in the output: +

+$ g++ -O3 -S something.cpp -o - | c++filt
+
+

Other than assembly output, we can also view preprocessor output with -E flag or cpp(1) command. +In general, building minimal examples to see certain behaviours is a decent debugging method. Of course, full blown +debuggers are also an option for exploration. + + +

Classes, Courses and Tutorials

+

I do not have any specific recommendations here at the moment. +

Prefer university-driven courses if available. Next in line are any free online tutorials. Always complement with a +book or technical documentation. Lastly, paid private "schools", online classes and bootcamps. I heard mixed opinions +about them in general, so research your options. + + +

Stack Overflow and LLMs

+

This is an equivalent to learning how to disarm explosives on a minefield with no tools whatsoever. Use these if you +don't know how to bite a certain problem, if you look for a very specific recommendation, or if you have forgotten +something trivial. You may find good answers. Always look or ask for answers with references to documentation or find +relevant sources yourself. On Stack Overflow you may even find authoritative answers. +

+ -- cgit v1.1