"As indicated above, we tried to specify clearly in which standard specific features were introduced. Few guidelines:\n",
"As indicated above, we tried to specify clearly in which standard specific features were introduced. Few guidelines:\n",
"\n",
"\n",
"- C++ 14 is now a safe bet for most compilers, so you should probably choose this one instead of C++ 11. Vincent is working on a library named [Gudhi](https://gudhi.inria.fr/) that is rather conservative for the standard use (in the sense they want most users to be able to compile the code without having to install brand new environment) and they switched to C++ 14 in August 2019.\n",
"- C++ 14 is now a safe bet for most compilers, so you should probably choose this one instead of C++ 11. Vincent is working on a library named [Gudhi](https://gudhi.inria.fr/) that is rather conservative for the standard use (in the sense they want most users to be able to compile the code without having to install brand new environment) and they switched to C++ 14 in August 2019.\n",
"- C++ 17 support is now really widespread as well, but you may still lack some features if your distro is a bit backward (for instance default gcc compiler on still supported Ubuntu LTS 18.04 does not support the brand new filesystem (yes C++ was not historically a _batteries included_ language...). \n",
"- C++ 17 support is now really widespread as well, but you may still lack some features if your distro is a bit backward (for instance default gcc compiler on still supported Ubuntu LTS 18.04 does not support the brand new filesystem library (yes C++ was not historically a _batteries included_ language...)). \n",
"\n",
"\n",
"\n",
"\n",
"### And C++ 20?\n",
"### And C++ 20?\n",
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# [Getting started in C++](./) - [A brief introduction](./0-introduction-to-C++.ipynb)
# [Getting started in C++](./) - [A brief introduction](./0-introduction-to-C++.ipynb)
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
<h1>Table of Contents<spanclass="tocSkip"></span></h1>
<h1>Table of Contents<spanclass="tocSkip"></span></h1>
<divclass="toc"><ulclass="toc-item"><li><span><ahref="#A-very-brief-historic"data-toc-modified-id="A-very-brief-historic-1">A very brief historic</a></span></li><li><span><ahref="#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><ulclass="toc-item"><li><span><ahref="#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><ahref="#But-which-one-should-you-use?-11,-14-or-17?"data-toc-modified-id="But-which-one-should-you-use?-11,-14-or-17?-2.2">But which one should you use? 11, 14 or 17?</a></span></li><li><span><ahref="#And-C++-20?"data-toc-modified-id="And-C++-20?-2.3">And C++ 20?</a></span></li></ul></li><li><span><ahref="#A-multi-paradigm-language"data-toc-modified-id="A-multi-paradigm-language-3">A multi-paradigm language</a></span></li></ul></div>
<divclass="toc"><ulclass="toc-item"><li><span><ahref="#A-very-brief-historic"data-toc-modified-id="A-very-brief-historic-1">A very brief historic</a></span></li><li><span><ahref="#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><ulclass="toc-item"><li><span><ahref="#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><ahref="#But-which-one-should-you-use?-11,-14-or-17?"data-toc-modified-id="But-which-one-should-you-use?-11,-14-or-17?-2.2">But which one should you use? 11, 14 or 17?</a></span></li><li><span><ahref="#And-C++-20?"data-toc-modified-id="And-C++-20?-2.3">And C++ 20?</a></span></li></ul></li><li><span><ahref="#A-multi-paradigm-language"data-toc-modified-id="A-multi-paradigm-language-3">A multi-paradigm language</a></span></li></ul></div>
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## A very brief historic
## A very brief historic
- C++ was first published in 1985 by Bjarne Stroustrup with the idea of extending C with object programming; the first name of the language was _C with classes_
- C++ was first published in 1985 by Bjarne Stroustrup with the idea of extending C with object programming; the first name of the language was _C with classes_
- The first standard was issued in 1998 and called _C++ 98_
- The first standard was issued in 1998 and called _C++ 98_
- A first (minor) update was issued in 2003 (and dubbed *C++ 03*)
- A first (minor) update was issued in 2003 (and dubbed *C++ 03*)
- The plan was to provide a major overhaul for the next version, which was called for a long time *C++ 0x*.
- The plan was to provide a major overhaul for the next version, which was called for a long time *C++ 0x*.
- 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.
- 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.
- 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:
- 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:
**C++ 14* was a polishing of *C++ 11*, as intended.
**C++ 14* was a polishing of *C++ 11*, as intended.
**C++ 17* introduced more new stuff than *C++ 14*, but not as many as initially intended.
**C++ 17* introduced more new stuff than *C++ 14*, but not as many as initially intended.
**C++ 20* is a major update, almost as groundbreaking as *C++ 11*.
**C++ 20* is a major update, almost as groundbreaking as *C++ 11*.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Which standard will be tackled in this lecture?
## Which standard will be tackled in this lecture?
### C++ 11/14/17 rather than C++ 98/03
### C++ 11/14/17 rather than C++ 98/03
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.
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.
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).
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).
### But which one should you use? 11, 14 or 17?
### But which one should you use? 11, 14 or 17?
As indicated above, we tried to specify clearly in which standard specific features were introduced. Few guidelines:
As indicated above, we tried to specify clearly in which standard specific features were introduced. Few guidelines:
- C++ 14 is now a safe bet for most compilers, so you should probably choose this one instead of C++ 11. Vincent is working on a library named [Gudhi](https://gudhi.inria.fr/) that is rather conservative for the standard use (in the sense they want most users to be able to compile the code without having to install brand new environment) and they switched to C++ 14 in August 2019.
- C++ 14 is now a safe bet for most compilers, so you should probably choose this one instead of C++ 11. Vincent is working on a library named [Gudhi](https://gudhi.inria.fr/) that is rather conservative for the standard use (in the sense they want most users to be able to compile the code without having to install brand new environment) and they switched to C++ 14 in August 2019.
- C++ 17 support is now really widespread as well, but you may still lack some features if your distro is a bit backward (for instance default gcc compiler on still supported Ubuntu LTS 18.04 does not support the brand new filesystem (yes C++ was not historically a _batteries included_ language...).
- C++ 17 support is now really widespread as well, but you may still lack some features if your distro is a bit backward (for instance default gcc compiler on still supported Ubuntu LTS 18.04 does not support the brand new filesystem library (yes C++ was not historically a _batteries included_ language...)).
### And C++ 20?
### And C++ 20?
C++ will not be addressed much in this lecture... essentially as we are not using it (yet).
C++ will not be addressed much in this lecture... essentially as we are not using it (yet).
It has been published officially at the end of 2020, but is still not widely supported by current compilers.
It has been published officially at the end of 2020, but is still not widely supported by current compilers.
We will obviously update this lecture when it becomes widespread, as it will introduce very cool stuff (and the promise of much better compilation errors for templates...)
We will obviously update this lecture when it becomes widespread, as it will introduce very cool stuff (and the promise of much better compilation errors for templates...)
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## A multi-paradigm language
## A multi-paradigm language
C++ was originally created with the will to provide object programming to C, but it is truly now a multi-paradigm language.
C++ was originally created with the will to provide object programming to C, but it is truly now a multi-paradigm language.
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++).
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++).
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!)
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!)
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# References
# References
(<aid="cit-Cukic2018"href="#call-Cukic2018">Čukić, 2018</a>) Ivan Čukić, ``_Functional Programming in C++_'', 01 2018.
(<aid="cit-Cukic2018"href="#call-Cukic2018">Čukić, 2018</a>) Ivan Čukić, ``_Functional Programming in C++_'', 01 2018.