summaryrefslogtreecommitdiff
path: root/where_to_learn_cxx.html
diff options
context:
space:
mode:
Diffstat (limited to 'where_to_learn_cxx.html')
-rw-r--r--where_to_learn_cxx.html216
1 files changed, 216 insertions, 0 deletions
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 @@
+<!doctype html>
+<html lang="en">
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="author" content="aki">
+<meta name="tags" content="C++, resources, literature, documentation">
+<meta name="published-on" content="2024-06-23T23:34:33+02:00">
+<link rel="icon" type="image/png" href="favicon.png">
+<link rel="stylesheet" href="style.css">
+
+<title>Where to Learn C++</title>
+
+<header>
+<nav><a href="https://ignore.pl">ignore.pl</a></nav>
+<time>23 June 2024</time>
+<h1>Where to Learn C++</h1>
+</header>
+
+<article>
+<p>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.
+<p>An alternative title would be: <i>where to read about C++</i> or <i>my links about C++</i>.
+<p>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...
+<ol>
+<li><a class="always-fresh" href="#literature">Literature</a>
+<li><a class="always-fresh" href="#standard-references">Standard References</a>
+<li><a class="always-fresh" href="#proposals">Proposals</a>
+<li><a class="always-fresh" href="#the-standard">The Standard</a>
+<li><a class="always-fresh" href="#implementations">Implementations</a>
+<li><a class="always-fresh" href="#headers">Headers</a>
+<li><a class="always-fresh" href="#source-code">Source Code</a>
+<li><a class="always-fresh" href="#boost">Boost</a>
+<li><a class="always-fresh" href="#conferences">Conferences</a>
+<li><a class="always-fresh" href="#core-guidelines">Core Guidelines</a>
+<li><a class="always-fresh" href="#code-style-guidelines">Code Style Guidelines</a>
+<li><a class="always-fresh" href="#interactive-exploration">Interactive Exploration</a>
+<li><a class="always-fresh" href="#classes-courses-and-tutorials">Classes, Courses and Tutorials</a>
+<li><a class="always-fresh" href="#stack-overflow-and-llms">Stack Overflow and LLMs</a>
+</ol>
+
+
+<h2 id="literature">Literature</h2>
+<p>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."</p>
+<img src="where_to_learn_cxx-1.png" alt="book covers">
+<p><span style="font-style: italic; font-size: 75%;">From left to right</span>
+<ol>
+<li><strong>Effective Modern C++</strong>, Scott Meyers
+<li><strong>The C++ Programming Language</strong>, Bjarne Stroustrup
+<li><strong>C++ Primer</strong>, Stanley B. Lippman, Josée Lajole, Barbara E. Moo
+</ol>
+<p>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.
+
+
+<h2 id="standard-references">Standard References</h2>
+<p>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.
+<ul>
+<li><a href="https://en.cppreference.com/w/">cppreference.com</a>
+<li><a href="https://cplusplus.com/reference/">cplusplus.com</a>
+</ul>
+<p>You are likely to use them the most compared to any other entry in this list. This is the case for me.
+<p>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.
+
+
+<h2 id="proposals">Proposals</h2>
+<p>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.
+<p>You can find them at <a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/">C++ Standards Committee
+Papers</a> index.
+<p>Alternatively, if you are looking for proposal regarding a particular feature, you can:
+<ol>
+<li>Go to <a href="https://en.cppreference.com/w/">cppreference.com</a>.
+<li>Find applicable C++ standard revision, e.g., <a href="https://en.cppreference.com/w/cpp/17">C++17</a>.
+<li>
+ Find feature in one of the matrices, e.g., <b>Structured Bindings</b> and associated
+ <a href="https://wg21.link/P0217R3">P0217R3</a>.
+<li>
+ <b>P0217R3</b> describes wording changes but refers to <a href="https://wg21.link/P0144R2">P0144R2</a> as original
+ proposal.
+</ol>
+
+
+<h2 id="the-standard">The Standard</h2>
+<p>Also known as <strong>ISO/IEC 14882</strong>.</p>
+<img src="where_to_learn_cxx-2.png" alt="c++ logo">
+<p>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.
+<p>You can buy the actual standard revisions at the ISO Store.
+<p>Draft is available at <a href="https://eel.is/c++draft/">eel.is/c++draft</a>.
+<p>Standard C++ has a homepage at <a href="https://isocpp.org/">isocpp.org</a> with a good amount of useful resources,
+i.a., <b>Get Started!</b>, <b>Tour</b>, and <b>Super-FAQ</b>.
+
+
+<h2 id="implementations">Implementations</h2>
+<p>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.
+<ul>
+<li>
+ <a href="https://gcc.gnu.org/onlinedocs/">GCC online documentation</a> contains both <b>GCC CPP Manual</b> and
+ <b>GCC Standard C++ Library Manual</b> for all stable and historical versions
+<li><a href="https://clang.llvm.org/docs/index.html">Clang documentation</a>
+<li><a href="https://libcxx.llvm.org/">libc++ documentation</a>
+<li><a href="https://learn.microsoft.com/en-us/cpp/">Microsoft C++, C, and Assembler documentation</a>
+<li>
+ <a href="https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2024-2/overview.html">
+ Intel oneAPI DPC++/C++ Compiler Developer Guide and Reference</a>
+</ul>
+
+
+<h2 id="headers">Headers</h2>
+<p>The gist of it is, know your include paths. For example to start with:
+<ol>
+<li><code>/usr/include/c++/14.1.1</code>
+<li><code>/usr/include/c++/14.1.1/x86_64-pc-linux-gnu</code>
+<li><code>/usr/include/c++/14.1.1/backward</code>
+<li><code>/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include</code>
+<li><code>/usr/local/include</code>
+<li><code>/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include-fixed</code>
+<li><code>/usr/include</code>
+</ol>
+<p>Of course, depending on your compiler, library provider and targets these will vary. Consult your compiler
+documentation.
+<p>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.
+
+
+<h2 id="source-code">Source Code</h2>
+<p>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?"
+<p>Selected pieces of software (alphabetical order):
+<ul>
+<!-- EnTT --><li><a href="https://github.com/skypjack/entt">EnTT</a>
+<!-- fmt --><li><a href="https://github.com/fmtlib/fmt">fmt</a>
+<!-- FreeCAD --><li><a href="https://github.com/FreeCAD/FreeCAD">FreeCAD</a>
+<!-- GoogleTest --><li><a href="https://github.com/google/googletest">GoogleTest</a>
+<!-- JSON --><li><a href="https://github.com/nlohmann/json">JSON</a>
+<!-- rpclib --><li><a href="https://github.com/rpclib/rpclib">rpclib</a>
+<!-- Yes, I sorted it by piping it to sort(1). -->
+</ul>
+<p>In general, just take a look at whatever software you use. You might even end up contributing to it and that's always
+good.
+
+
+<h2 id="boost">Boost</h2>
+<p>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.
+<p>Docs version index is located at <a href="https://www.boost.org/doc/">boost.org/doc</a>.
+
+
+<h2 id="conferences">Conferences</h2>
+<p>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. <b>Isocpp.org</b> maintains <a href="https://isocpp.org/wiki/faq/conferences-worldwide">a list of worldwide
+conferences</a>.
+<p><a href="https://www.youtube.com/@CppCon">CppCon YouTube channel</a> 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.
+
+
+<h2 id="core-guidelines">Core Guidelines</h2>
+<p>A document maintained by Bjarne Stroustrup and Herb Sutter with a whole lot of recommendations. It is available
+online at <a href="https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines">C++ Core Guidelines</a>.
+<p>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.
+
+
+<h2 id="code-style-guidelines">Code Style Guidelines</h2>
+<p>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.
+<p>Examples of coding styles (alphabetical order):
+<ul>
+<!-- GCC Co... --><li><a href="https://gcc.gnu.org/codingconventions.html">GCC Coding Conventions</a>
+<!-- Google... --><li><a href="https://google.github.io/styleguide/cppguide.html">Google C++ Style Guide</a>
+<!-- LLVM C... --><li><a href="https://llvm.org/docs/CodingStandards.html">LLVM Coding Standards</a>
+</ul>
+
+
+<h2 id="interactive-exploration">Interactive Exploration</h2>
+<p>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 <a href="https://godbolt.org/">Compiler Explorer</a>.
+<p>We can get similar results in local environment. For example, we can make GCC emit assembly output with
+<code>-S</code> flag. Another command, <b>c++filt</b>(1) can be used to demangle symbols in the output:
+<pre>
+$ g++ -O3 -S something.cpp -o - | c++filt
+</pre>
+<p>Other than assembly output, we can also view preprocessor output with <code>-E</code> flag or <b>cpp</b>(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.
+
+
+<h2 id="classes-courses-and-tutorials">Classes, Courses and Tutorials</h2>
+<p>I do not have any specific recommendations here at the moment.
+<p>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.
+
+
+<h2 id="stack-overflow-and-llms">Stack Overflow and LLMs</h2>
+<p>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.
+</article>
+<script src="https://stats.ignore.pl/track.js"></script>