diff --git a/.gitignore b/.gitignore index 6e42ac7b4dae741e7df4f97daa5f8317e274dcf2..fc4a464284fc1ad70db3b50f9238cfe1cc63fc24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,21 @@ +### ATTENTION ### +# This is the GLOBAL gitignore, please do NOT change this file, +# unless it should be available for everyone +# Please change the LOCAL gitignore (.git/info/exclude) to customize +# excluding files/folders from being recognized by git + +# Recovery files +*~ + +# Backup files +*.bak + +# Most used editor files +*.vscode +*.directory +*.DS_Store + +# Jupyter files .ipynb_checkpoints */.ipynb_checkpoints Untitled.ipynb diff --git a/0-introduction-to-C++.ipynb b/0-introduction-to-C++.ipynb index 061624ffa8ab3d9cb0cb409893297d7407eb8aa2..2869241d0f9ae3a4328f36d6a608b635b68a838a 100644 --- a/0-introduction-to-C++.ipynb +++ b/0-introduction-to-C++.ipynb @@ -8,7 +8,7 @@ } }, "source": [ - "# [Getting started in C++](/) - [A brief introduction](./Introduction.ipynb)" + "# [Getting started in C++](/) - [A brief introduction](./0-introduction-to-C++.ipynb)" ] }, { @@ -18,7 +18,7 @@ }, "source": [ "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n", - "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#A-very-brief-historic\" data-toc-modified-id=\"A-very-brief-historic-1\">A very brief historic</a></span></li><li><span><a href=\"#Which-standard-will-be-tackled-in-this-lecture?\" data-toc-modified-id=\"Which-standard-will-be-tackled-in-this-lecture?-2\">Which standard will be tackled in this lecture?</a></span><ul class=\"toc-item\"><li><span><a href=\"#C++-11/14/17-rather-than-C++-98/03\" data-toc-modified-id=\"C++-11/14/17-rather-than-C++-98/03-2.1\">C++ 11/14/17 rather than C++ 98/03</a></span></li><li><span><a href=\"#But-which-one?-11,-14-or-20?\" data-toc-modified-id=\"But-which-one?-11,-14-or-20?-2.2\">But which one? 11, 14 or 20?</a></span></li><li><span><a href=\"#And-C++-20?\" data-toc-modified-id=\"And-C++-20?-2.3\">And C++ 20?</a></span></li></ul></li><li><span><a href=\"#A-multi-paradigm-language\" data-toc-modified-id=\"A-multi-paradigm-language-3\">A multi-paradigm language</a></span></li></ul></div>" + "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#A-very-brief-historic\" data-toc-modified-id=\"A-very-brief-historic-1\">A very brief historic</a></span></li><li><span><a href=\"#Which-standard-will-be-tackled-in-this-lecture?\" data-toc-modified-id=\"Which-standard-will-be-tackled-in-this-lecture?-2\">Which standard will be tackled in this lecture?</a></span><ul class=\"toc-item\"><li><span><a href=\"#C++-11/14/17-rather-than-C++-98/03\" data-toc-modified-id=\"C++-11/14/17-rather-than-C++-98/03-2.1\">C++ 11/14/17 rather than C++ 98/03</a></span></li><li><span><a href=\"#But-which-one-should-you-use?-11,-14-or-20?\" data-toc-modified-id=\"But-which-one-should-you-use?-11,-14-or-20?-2.2\">But which one should you use? 11, 14 or 20?</a></span></li><li><span><a href=\"#And-C++-20?\" data-toc-modified-id=\"And-C++-20?-2.3\">And C++ 20?</a></span></li></ul></li><li><span><a href=\"#A-multi-paradigm-language\" data-toc-modified-id=\"A-multi-paradigm-language-3\">A multi-paradigm language</a></span></li></ul></div>" ] }, { @@ -32,7 +32,7 @@ "- A first (minor) update was issued in 2003 (and dubbed *C++ 03*)\n", "- The plan was to provide a major overhaul for the next version, which was called for a long time *C++ 0x*.\n", "- The schedule failed, as the next standard turned out to be *C++ 11*. It is a major update, with lots of new features and syntactic sugar introduced.\n", - "- The plan was now to publish a release every three years, alternating minor and major ones. It has proved more successful than for *C++ 0x*, except for the minor/major:\n", + "- The plan was now to publish a release every three years, alternating minor and major ones. The committee followed the planned schedule more successfully than for *C++ 0x*, except for the minor/major:\n", " * *C++ 14* was a polishing of *C++ 11*, as intended.\n", " * *C++ 17* introduced more new stuff than *C++ 14*, but not as many as initially intended.\n", " * *C++ 20* should therefore be a major update, almost as groundbreaking as *C++ 11*.\n", @@ -52,9 +52,9 @@ "\n", "The new major standard is now widely supported by compilers, and introduces many features that are very useful. As it is much more pleasant to use, it would be a shame to restrict ourselves to the older versions of the standard.\n", "\n", - "However, you may have to tackle legacy code which is written in C++ 98/03, so we indicated as much as possible for each feature presented when it was actually introduced.\n", + "However, you may have to tackle legacy code which is written in C++ 98/03, so we indicated as much as possible for each recent feature presented when it was actually introduced (if not specified assume it was already present in C++ 98).\n", "\n", - "### But which one? 11, 14 or 20?\n", + "### But which one should you use? 11, 14 or 20?\n", "\n", "As indicated above, we tried to specify clearly in which standard specific features were introduced. Few guidelines:\n", "\n", @@ -86,7 +86,7 @@ "\n", "There are actually even more: functional programming for instance seems to be gaining traction at the moment and will be eased in C++ 20 standard (see \\cite{Cukic2018} for more about functional programming in C++).\n", "\n", - "This richness is not always perceived as a boon: there is a section in the [Wikipedia page](https://en.wikipedia.org/wiki/C%2B%2B#Criticism) dedicated to the criticisms addressed at C++ for by notorious developers (but also a defense by Brian Kernighan!)" + "This richness is not always perceived as a boon: there is a section in the [Wikipedia page](https://en.wikipedia.org/wiki/C%2B%2B#Criticism) dedicated to the criticisms addressed at C++ by notorious developers (but also a defense by Brian Kernighan!)" ] }, { diff --git a/2-ObjectProgramming/3-constructors-destructor.ipynb b/2-ObjectProgramming/3-constructors-destructor.ipynb index 981cb0883890abafe2a358ad182a944c8b54aadd..8ae868bce73d30dceb37e7b8495c6c2270507142 100644 --- a/2-ObjectProgramming/3-constructors-destructor.ipynb +++ b/2-ObjectProgramming/3-constructors-destructor.ipynb @@ -503,7 +503,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Please notice doing so doesn't prevent you to use the efficient initialization of `a_` in the constructor with arguments: the values thus provided in the data attributes definitions are used only in the constructor doesn't supersede them.\n", + "Please notice doing so doesn't prevent you to use the efficient initialization of `a_` in the constructor with arguments: the values thus provided in the data attributes definitions are used only if the constructor doesn't supersede them.\n", "\n", "In the same spirit, if you get pointers as data attributes it is a good idea to set them by default to `nullptr`: this way you may check with an [`assert`](../5-UsefulConceptsAndSTL/1-ErrorHandling.ipynb#Assert) it has been correctly initialized before use." ] diff --git a/2-ObjectProgramming/4-encapsulation.ipynb b/2-ObjectProgramming/4-encapsulation.ipynb index 19c315fda618881680ff3a80397710021694454b..f2400ee46afab8f8272467c94f6b65663f8be69b 100644 --- a/2-ObjectProgramming/4-encapsulation.ipynb +++ b/2-ObjectProgramming/4-encapsulation.ipynb @@ -171,7 +171,7 @@ "source": [ "As you may see on our example, there might be as many public and private sections as you wish, and their ordering doesn't matter (often coding standards recommend such an ordering, saying for instance to put public interface first, but the langage itself does not care in the least).\n", "\n", - "One side note for those accustomed to other languages: C++ is really hell bent about privacy status. It is not a gentleman's agreement as in Python where the `_` preffix is an indication an attribute should not be used publicly but a user may supersede the choice anyway; in C++ you can't call directly a private method of a class\n", + "One side note for those accustomed to other languages: C++ is really hell bent about privacy status. It is not a gentleman's agreement as in Python where the `_` prefix is an indication an attribute should not be used publicly but a user may supersede the choice anyway; in C++ you can't call directly a private method of a class\n", "without modifying the class interface yourself - which is ill-advised, especially if we're talking about code from a third-party library.\n", "\n", "\n", diff --git a/6-InRealEnvironment/6-Tools.ipynb b/6-InRealEnvironment/6-Tools.ipynb index 1404e3b7be802cbccc215817b433d9a9f53c04b7..3e0ef6b91c793de256b46c9705b377932f9b4728 100644 --- a/6-InRealEnvironment/6-Tools.ipynb +++ b/6-InRealEnvironment/6-Tools.ipynb @@ -77,6 +77,9 @@ "\n", "[Catch2](https://github.com/catchorg/Catch2) is a more recent test facility which is aimed at being user-friendly.\n", "\n", + "### Doctest\n", + "\n", + "[doctest](https://github.com/onqtam/doctest) is a C++ testing framework but is by far the fastest both in compile times (by orders of magnitude) and runtime compared to other feature-rich alternatives. It brings the ability of compiled languages to have tests written directly in the production code thanks to a fast, transparent and flexible test runner with a clean interface.\n", "\n", "### Google test\n", "\n", diff --git a/environment.yml b/environment.yml index b3cc0e8e845754c4ea2690562f349dbad1bed0cc..2b140284e796e8fb7a6bbbb181e81900da29d0c4 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: formation_cpp_2020 +name: formation_cpp channels: - conda-forge dependencies: