Commit f00198ca authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Final clean-up for part 6 and 7.

parent ae99e365
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [C++ in a real environment](/notebooks/6-InRealEnvironment/0-main.ipynb)"
"# [Getting started in C++](/) - [C++ in a real environment](./0-main.ipynb)"
]
},
{
......@@ -20,12 +20,12 @@
"We won't do that in detail (CMake tool for instance would deserve its own dedicated lecture...) but give the hints required to understand how C++ is operated in more realistic settings than a Jupyter notebook.\n",
"\n",
"\n",
"* [Set up a minimal environment](/notebooks/6-InRealEnvironment/1-SetUpEnvironment.ipynb)\n",
"* [File structure of a C++ program](/notebooks/6-InRealEnvironment/2-FileStructure.ipynb)\n",
"* [Compilers](/notebooks/6-InRealEnvironment/3-Compilers.ipynb)\n",
"* [Third-party libraries: how to include them without getting their compilation warnings](/notebooks/6-InRealEnvironment/4-ThirdParty.ipynb)\n",
"* [Namespaces](/notebooks/6-InRealEnvironment/5-Namespace.ipynb)\n",
"* [Tools](/notebooks/6-InRealEnvironment/6-Tools.ipynb)\n",
"* [Set up a minimal environment](./1-SetUpEnvironment.ipynb)\n",
"* [File structure of a C++ program](./2-FileStructure.ipynb)\n",
"* [Compilers](./3-Compilers.ipynb)\n",
"* [Third-party libraries: how to include them without getting their compilation warnings](./4-ThirdParty.ipynb)\n",
"* [Namespaces](./5-Namespace.ipynb)\n",
"* [Tools](./6-Tools.ipynb)\n",
"\n"
]
},
......@@ -34,7 +34,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -44,14 +44,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [C++ in a real environment](/notebooks/6-InRealEnvironment/0-main.ipynb) - [Set up environment](/notebooks/6-InRealEnvironment/1-SetUpEnvironment.ipynb)"
"# [Getting started in C++](/) - [C++ in a real environment](./0-main.ipynb) - [Set up environment](./1-SetUpEnvironment.ipynb)"
]
},
{
......@@ -57,9 +57,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[1minput_line_7:5:1: \u001b[0m\u001b[0;1;31merror: \u001b[0m\u001b[1munknown type name 'sudo'\u001b[0m\n",
"sudo apt-get install --no-install-recommends -y software-properties-common \n",
"\u001b[0;1;32m^\n",
"\u001b[0m\u001b[1minput_line_7:5:9: \u001b[0m\u001b[0;1;31merror: \u001b[0m\u001b[1mexpected ';' at end of declaration\u001b[0m\n",
"sudo apt-get install --no-install-recommends -y software-properties-common \n",
"\u001b[0;1;32m ^\n",
"\u001b[0m\u001b[0;32m ;\n",
"\u001b[0m"
]
},
{
"ename": "Interpreter Error",
"evalue": "",
"output_type": "error",
"traceback": [
"Interpreter Error: "
]
}
],
"source": [
"// In a terminal\n",
"\n",
......@@ -71,9 +94,8 @@
"sudo add-apt-repository ppa:ubuntu-toolchain-r/test\n",
"sudo apt-get update\n",
"\n",
"// Installing the more recent gcc; which is 8 at the time of this writing \n",
"// (9 exists but is not provided yet in the PPA).\n",
"sudo apt-get install -y g++-8"
"// Installing the more recent gcc; which is 9 at the time of this writing \n",
"sudo apt-get install -y g++-9"
]
},
{
......@@ -90,14 +112,14 @@
"outputs": [],
"source": [
"// In a terminal\n",
"sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 100"
"sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"More realistically, you will install gcc and perhaps gfortran as well; the following command make sure all are kept consistent (you do not want to mesh gcc 7 with g++ 8 for instance...):"
"More realistically, you will install gcc and perhaps gfortran as well; the following command make sure all are kept consistent (you do not want to mesh gcc 7 with g++ 9 for instance...):"
]
},
{
......@@ -107,16 +129,16 @@
"outputs": [],
"source": [
"// In a terminal\n",
"sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 \n",
" --slave /usr/bin/g++ g++ /usr/bin/g++-8\n",
" --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-8"
"sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 \n",
" --slave /usr/bin/g++ g++ /usr/bin/g++-9\n",
" --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-9"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A [Dockerfile](/notebooks/6-InRealEnvironment/Docker/Dockerfile.ubuntu) was provided to create an image with this basic setup."
"A [Dockerfile](./Docker/Dockerfile.ubuntu) was provided to create an image with this basic setup."
]
},
{
......@@ -166,7 +188,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Dockerfiles have also been provided for [gcc](/notebooks/6-InRealEnvironment/Docker/Dockerfile.fedora.gcc) and [clang](/notebooks/6-InRealEnvironment/Docker/Dockerfile.fedora.clang) settings.\n",
"Dockerfiles have also been provided for [gcc](./Docker/Dockerfile.fedora.gcc) and [clang](./Docker/Dockerfile.fedora.clang) settings.\n",
"\n",
"\n",
"### macOS\n",
......@@ -234,7 +256,7 @@
"The usual possibilities are:\n",
"\n",
"* Build system provided by your IDE. Might be easier to use (definitely the case for XCode which I'm familiar with once you grasp how it is intended to work) but you bind your potential users to use the same IDE (even if now some relies upon CMake we'll see shortly).\n",
"* [**makefiles**](https://en.wikipedia.org/wiki/Makefile) is the venerable ancestor, which is really too painful to write and not automated enough for my taste.\n",
"* [Makefile](https://en.wikipedia.org/wiki/Makefile) is the venerable ancestor, which is really too painful to write and not automated enough for my taste.\n",
"* [CMake](https://cmake.org) is the build system probably with the more traction now; it is a cross-platform build system which is rather powerful but not that easy to learn. Official documentation is terse; you may try [this](https://cliutils.gitlab.io/modern-cmake/) or [that](https://cgold.readthedocs.io/en/latest/) to understand it better. Please notice CMake was heavily changed when switching from version2 to version 3; take a recent documentation if you want to learn \"modern\" CMake. The principle of CMake is to provide a generic configuration that may be used for different build tools: by default you generate a Makefile, but you may choose another generator such as Ninja (see below) or a specific IDE.\n",
"* [meson](https://mesonbuild.com/) is a more recent alternative which aims to be simpler to use than CMake. Never used it so can't say much about it.\n",
"* [SCons](https://www.scons.org/) is a build system built upon Python which lets you write your own Python functions in the build system. The concept is appealing, but the actual use is actually dreadful and the provided build is much slower than what other build system provides. Avoid it!\n",
......@@ -247,7 +269,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -257,14 +279,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -37,7 +37,7 @@
"* A **static** library, usually with a **.a** extension, is actually included directly into any executable that requires it. The advantage is that you just need the bare executable to run your code: the library is no longer required at runtime. The inconvenient is that the storage space may balloon up rather quickly: each executable will contain the whole library! \n",
"* A **shared** library, which extension may vary wildly from one OS to another (**.dylib**, **.so**, **.dll**, etc...), is on the other hand required at runtime by the executable that was built with it. The advantage is that executables are thus much smaller. They are often described on the Web as the way to go; my personal experience with them is however less rosy as each OS handles them differently (noticeably the way to indicate in which location the dynamic libraries should be looked at differ rather wildly...)\n",
"\n",
"The best if possible is to enable generation of your library in either type... but it is a bit of work in your build system.\n",
"The best if possible is to enable generation of your library in either type... but it requires a bit of work with your build system.\n",
"\n",
"## Source file\n",
"\n",
......@@ -92,7 +92,7 @@
"where:\n",
"\n",
"- `g++` is the name of the compiler. You may provide clang++ if you wish.\n",
"- `-std=c++17` tells to use this version of the standard (-std=c++20 begins to appear but is not yet published as its name indicates...). If not specified the compilers tend to assume C++ 11 but may issue warnings if some features introduced with this standard are used.\n",
"- `-std=c++17` tells to use this version of the standard. If not specified the compilers tend to assume C++ 11 but may issue warnings if some features introduced with this standard are used.\n",
"- `hello.cpp` is the name of the source file.\n",
"- `hello` is the name of the executable produced. If the `-o hello` is omitted, the executable is arbitrarily named `a.out`, exactly as in C."
]
......@@ -129,7 +129,7 @@
"source": [
"### Source files extensions\n",
"\n",
"The plural is not a mistake: unfortunately, contrary to many languages, there is no universal convention upon the extension to use for C++ files. There are widely spread conventions, but a library may choose not to follow them. \n",
"The plural is not a mistake: unfortunately, contrary to many languages, there is no universal convention upon the extensions to use for C++ files. There are widely spread conventions, but a library may choose not to follow them. \n",
"\n",
"Editors and IDE know the most common ones and usually provide a way to add your own spin so that they may provide language recognition and all that goes with it (colored syntax, completion helper and so on).\n",
"\n",
......@@ -146,7 +146,7 @@
"\n",
"This code is not very subtle: everything is in the same file, so we are in a very simplistic case in which only one file is compiled, and there are no need to find ways to specify how several files relate to each other.\n",
"\n",
"You may imagine working in a single file is not an very common option: it hinders reusability, and it would be cumbersome to navigate in a file with thousands or more lines or code.\n",
"You may imagine working in a single file is not an very common option: it hinders reusability, and it would be cumbersome to navigate in a file with thousands or more lines or code (if you're really curious to an extreme case have a look at the amalgamation ([2.28 Mo zip here](https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip)) of sqlite code, in which all the code is put in a same source file...)\n",
"\n",
"We want know to separate the main() and the actual content of the code:"
]
......@@ -681,6 +681,7 @@
"mkdir build // create a directory to separate build from source files and so on\n",
"cd build\n",
"cmake .. // will create the Makefile; as no generator was provided with -G Unix makefile is chosen.\n",
" // The directory indicated by .. MUST include the main CMakeLists.txt of the project.\n",
"make"
]
},
......@@ -893,7 +894,7 @@
"\n",
"This is not without cost: obviously in a file where `Bar` is actually needed you will need to include it properly: with just `#include \"foo.hpp\"` you can't for instance call a method of `Bar`. It is nonetheless a very nice trick to know; there is even an idiom call [Pimpl idiom](https://arne-mertz.de/2019/01/the-pimpl-idiom/) that relies upon forward declaration.\n",
"\n",
"This is however not the only use for it though: to define a shared_ptr/weak_ptr you [also need](/notebooks/7-Appendix/WeakPtr.ipynb) to use this capability."
"This is however not the only use for it though: to define a shared_ptr/weak_ptr you [also need](../7-Appendix/WeakPtr.ipynb) to use this capability."
]
},
{
......@@ -901,7 +902,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -911,14 +912,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [C++ in a real environment](/notebooks/6-InRealEnvironment/0-main.ipynb) - [Clang ang gcc compilers](/notebooks/6-InRealEnvironment/3-Compilers.ipynb)"
"# [Getting started in C++](/) - [C++ in a real environment](./0-main.ipynb) - [Clang ang gcc compilers](./3-Compilers.ipynb)"
]
},
{
......@@ -36,7 +36,7 @@
"\n",
"[GCC](http://gcc.gnu.org/) is a free to use compiler which is now around for a while; it is mostly for Unix systems but may be used with Windows with some additional set-up (I don't master this but see for instance this [StackOverflow question](https://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw)).\n",
"\n",
"As many others softwares, GCC changed its version system: gcc 3 and 4 were there for decades, and now the versions change more swiftly, with gcc 8 the current stable version and a beta of 9 already available.\n",
"As many others softwares, GCC changed its version system: gcc 3 and 4 were there for decades, and now the versions change more swiftly, with gcc 9 the current stable version.\n",
"\n",
"`gcc` was long known for its terse user interface: until recently color were not provided in outputs, and error messages were a bit cryptic for the beotians. It changed though when `clang` appeared.\n",
"\n",
......@@ -115,7 +115,7 @@
"* Some do not behave exactly the same way. For instance I activate `-Wshadow` in clang but not in gcc where it is too cumbersome for my taste.\n",
"* Some are specific to a compiler... and it becomes truer with each new version of clang, which often introduces a new warning.\n",
"\n",
"But what I really like with clang is they took the opposite approach warning side: they provide a `-Weverything` which really activates all of them! (`-Wall -Wextra` are also supported but similar to gcc counterparts).\n",
"But what I really like with clang is they took the opposite approach warning side: they provide a `-Weverything` which really activates all of them! (`-Wall -Wextra` are also supported but similar to their gcc counterparts).\n",
"\n",
"Of course, you may deactivate a warning you do not want by adding -Wno-foo where _foo_ is the warning not to consider.\n",
"\n",
......@@ -129,7 +129,7 @@
"-Wno-exit-time-destructors // I use an advanced pattern that doesn't mesh with this one.\n",
"-Wno-global-constructors // same\n",
"-Wno-documentation // Some Doxygen were incorrectly indicated as inadequate\n",
"-Wno-documentation-unknown-command // A Doxygen command I used was not recognized\n",
"-Wno-documentation-unknown-command // A valid Doxygen command I used was not recognized\n",
"-Wno-undefined-func-template // Required weird code in header file; didn't understand this one to be honest\n",
"-Wno-c++1z-extensions // I assume my code uses up C++ 17\n",
"-Wno-unused-template // A very recent one that tells if a template is never used \n",
......@@ -172,7 +172,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......
......@@ -274,7 +274,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -284,14 +284,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [C++ in a real environment](/notebooks/6-InRealEnvironment/0-main.ipynb) - [Namespaces](/notebooks/6-InRealEnvironment/5-Namespace.ipynb)"
"# [Getting started in C++](/) - [C++ in a real environment](./0-main.ipynb) - [Namespaces](./5-Namespace.ipynb)"
]
},
{
......@@ -287,7 +287,7 @@
"\n",
"Your mileage may vary on this, but I really advise you to use at least one that would encompass all the content of your project. This way, you prevent the drawback I mentioned in the introduction about possible name conflict with a third-party library namesake function.\n",
"\n",
"The `Internal` I used to illustrate layers is not innocent: it is also a common way to indicate end-users they shouldn't bother with some utility and/or internal functionalities. For instance in Boost library they have a namespace `detail`: any stuff defined in `boost::detail` namespace is clearly an indication you shouldn't bother except if you are implementing yourself a Boost library (I gather you would not be reading this tutorial if that is the case!)\n",
"The `Internal` I used to illustrate layers is not innocent: it is also a common way to indicate end-users they shouldn't bother with some utility and/or internal functionalities. For instance in Boost library there is a namespace `detail`: any stuff defined in `boost::detail` namespace is clearly an indication you shouldn't bother except if you are implementing yourself a Boost library (I gather you would not be reading this tutorial if that is the case!)\n",
"\n",
"\n"
]
......@@ -310,7 +310,7 @@
"source": [
"## Good practice: free functions closely associated to a class should be put in the same namespace\n",
"\n",
"We saw [previously](/notebooks/3-Operators/1-Intro.ipynb) that operators may be overloaded for your own types outside of the class (it is even mandatory to do so for some operators such [stream ones](/notebooks/3-Operators/3-Stream.ipynb)).\n",
"We saw [previously](../3-Operators/1-Intro.ipynb) that operators may be overloaded for your own types outside of the class (it is even mandatory to do so for some operators such [stream ones](../3-Operators/3-Stream.ipynb)).\n",
"\n",
"The rule in this case is to define them in the **same namespace** as the one in which the class itself is defined. This way, you ensure the overload may be found even if the calling site is in an entirely different namespace.\n",
"\n"
......@@ -464,7 +464,7 @@
"metadata": {},
"outputs": [],
"source": [
"cout << \"Without std:: preffix!\"; // Works!"
"cout << \"Without std:: preffix!\"; // Works! - or at least should work: Xeus Cling seems lost here..."
]
},
{
......@@ -618,7 +618,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -628,14 +628,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [C++ in a real environment](/notebooks/6-InRealEnvironment/0-main.ipynb) - [External tools](/notebooks/6-InRealEnvironment/6-Tools.ipynb)"
"# [Getting started in C++](/) - [C++ in a real environment](./0-main.ipynb) - [External tools](./6-Tools.ipynb)"
]
},
{
......@@ -39,7 +39,7 @@
"\n",
"[cppcheck](http://cppcheck.sourceforge.net/) is a static analyser program; it might really help you to find some questionable constructs in your code. As many tools, it's not 100 % accurate and sometimes it may raise false positives, but I nonetheless recommend it warmly.\n",
"\n",
"[cpplint](https://github.com/cpplint/cpplint) is also worth a look, we mentioned it for instance in [this chapter](/notebooks/6-InRealEnvironment/2-FileStructure.ipynb) to track down missing includes in files.\n",
"[cpplint](https://github.com/cpplint/cpplint) is also worth a look, we mentioned it for instance in [this chapter](./2-FileStructure.ipynb) to track down missing includes in files.\n",
"\n",
"[clang-tidy](https://clang.llvm.org/extra/clang-tidy/) was recently recommanded to us by colleagues from [LoOPS network](https://reseau-loops.github.io/index.html).\n",
"\n",
......@@ -58,7 +58,7 @@
"\n",
"## Sonarqube\n",
"\n",
"[Sonarqube](https://www.sonarqube.org/) is a development platform which inspects your code and helps to figure out where there are issues. It enables integration of multiple tools such as cppcheck mentioned earlier. If you're Inria staff, an instance was set by our [Bordeaux colleagues](https://sonarqube.bordeaux.inria.fr/) and is available for you.\n",
"[Sonarqube](https://www.sonarqube.org/) is a development platform which inspects your code and helps to figure out where there are issues. It enables integration of multiple tools such as cppcheck mentioned earlier. If you're Inria staff, an instance was set by our [Bordeaux colleagues](http://sed.bordeaux.inria.fr/) and is [available](https://sonarqube.inria.fr/) for you.\n",
"\n",
"For open-source projects, the company behind Sonarqube provides a [freely accessible platform]( https://sonarcloud.io/about).\n",
"\n",
......@@ -86,7 +86,7 @@
"\n",
"## Build system\n",
"\n",
"Already mentioned [here](/notebooks/6-InRealEnvironment/1-SetUpEnvironment.ipynb#Build-system).\n",
"Already mentioned [here](./1-SetUpEnvironment.ipynb#Build-system).\n",
"\n",
"## Code formatters\n",
"\n",
......@@ -126,7 +126,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -136,14 +136,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [Appendix](/notebooks/7-Appendix/0-main.ipynb)"
"# [Getting started in C++](/) - [Appendix](./0-main.ipynb)"
]
},
{
......@@ -13,13 +13,13 @@
"source": [
"This appendix groups some stuff just mentioned in earlier tutorials but that I have chosen not to speak longly about because the lecture is already long enough as it is and they might be a tiny bit more complex for some of them.\n",
"\n",
"* [Breaking circular definition of shared pointers with weak pointers](/notebooks/7-Appendix/WeakPtr.ipynb) explains how to set up properly a circular relationship shared/weak pointers (unfortunately the way to set it up properly is often coyly mentioned but not explained); this is a follow-up of the notebook about [smart pointers](/notebooks/5-UsefulConceptsAndSTL/6-SmartPointers.ipynb).\n",
"* [Breaking circular definition of shared pointers with weak pointers](./WeakPtr.ipynb) explains how to set up properly a circular relationship shared/weak pointers (unfortunately the way to set it up properly is often coyly mentioned but not explained); this is a follow-up of the notebook about [smart pointers](../5-UsefulConceptsAndSTL/6-SmartPointers.ipynb).\n",
"\n",
"* [CRTP](/notebooks/7-Appendix/Crtp.ipynb) is one of my favourite idiom to provide a same functionality to utterly different classes; it was teased in the [notebook](/notebooks/4-Templates/5-MoreAdvanced.ipynb) about advanced features with templates.\n",
"* [CRTP](./Crtp.ipynb) is one of my favourite idiom to provide a same functionality to utterly different classes; it was teased in the [notebook](../4-Templates/5-MoreAdvanced.ipynb) about advanced features with templates.\n",
"\n",
"* [Homemade exceptions](/notebooks/7-Appendix/HomemadeException.ipynb) just provides the instantiation of the class I personally use when I want to raise an exception; it's a direct follow-up of the section that [mentioned it](/notebooks/5-UsefulConceptsAndSTL/1-ErrorHandling.ipynb#The-exception-class-I-use).\n",
"* [Homemade exceptions](./HomemadeException.ipynb) just provides the instantiation of the class I personally use when I want to raise an exception; it's a direct follow-up of the section that [mentioned it](../5-UsefulConceptsAndSTL/1-ErrorHandling.ipynb#The-exception-class-I-use).\n",
"\n",
"* [Switch](/notebooks/7-Appendix/Switch.ipynb) is the less important one: it just explains `switch` statement and the syntax caveats you might encounter with them. It was mentioned in the [early notebook](/notebooks/1-ProceduralProgramming/2-Conditions-and-loops.ipynb#switch-statement) about conditions.\n",
"* [Switch](./Switch.ipynb) is the less important one: it just explains `switch` statement and the syntax caveats you might encounter with them. It was mentioned in the [early notebook](../1-ProceduralProgramming/2-Conditions-and-loops.ipynb#switch-statement) about conditions.\n",
"\n"
]
},
......@@ -28,7 +28,7 @@
"metadata": {},
"source": [
"\n",
"© _CNRS 2016_ - _Inria 2018-2019_ \n",
"© _CNRS 2016_ - _Inria 2018-2020_ \n",
"_This notebook is an adaptation of a lecture prepared by David Chamont (CNRS) under the terms of the licence [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/)_ \n",
"_The present version has been written by Sébastien Gilles and Vincent Rouvreau (Inria)_"
]
......@@ -38,14 +38,14 @@
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xeus-cling-cpp17"
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "-std=c++17"
"version": "17"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Getting started in C++](/) - [Curiously recurrent template pattern](/notebooks/7-Appendix/Crtp.ipynb)"
"# [Getting started in C++](/) - [Curiously recurrent template pattern](./Crtp.ipynb)"
]
},
{
......@@ -50,18 +50,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#include <iostream>\n",
"\n",
"using uint = unsigned int;"
"using uint = unsigned int; // just to bypass a Xeus-cling limitation..."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -87,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......@@ -100,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
......@@ -111,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
......@@ -123,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
......@@ -133,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
......@@ -143,9 +143,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Carrot 0\n",
"Cabbage 2\n",
"Carrot 1\n",
"Cabbage 3\n"
]
}
],
"source": [
"{\n",
" Carrot carrot[2];\n",
......@@ -172,7 +183,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
......@@ -204,7 +215,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
......@@ -216,7 +227,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
......@@ -228,9 +239,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Carrot 6\n",