License : Creative Commons Attribution 4.0 International (CC BY-NC-SA 4.0)
Copyright : Frédéric Pennerath, Hervé Frezza-Buet, CentraleSupelec
Last modified : January 24, 2022 17:12
Link to the source : index.md

Table of contents

C++@CentraleSupélec

This page gathers C++ teaching materials, developped at CentraleSupélec. It is made of a table of contents, where links to different kind of topics can be reached.

Fill free to explore the topics in the order you want, even if they are organized here so that you can enter C++ progressively.

Getting started

Installing a C++ compiler

The C++ we are teaching here is standard, but the materials have been tested with the gnu compiler g++, using linux. Windows and MacOS users have to make a c++ compiler available on their workstation on their own.

Intalling g++ on Ubuntu is straightforward

mylogin@mymachine:~$ sudo apt install g++

Understanding command lines

Even if many SDK exist to handle the compiling of big projects, it can be nice, during learning, to invoke directly the compiler for every single compiling, apart for any automatic process. It is thus a good idea to be familiar with bash-like command interpretors.

For example, you can check that you are able to run the following command on a terminal in order to get your compiler version (this works for the gnu compiler).

mylogin@mymachine:~$ g++ -v

Have a nice editor and a nice console.

You can use emacs, vim, geany, vscode… or any kind of editor that highlights C++ code. For using command lines, you need a nice console, i.e. a terminal that understand colors and UTF-8.

Default terminal on linux does the job. For editing, vscode can be a good start if you are not already familiar with a good editor.

Introduction

First (but crucial) steps.

First, take the time to follow precisely the C++ self-study. It teaches you the basics of C++, stressing how memory is handles and how C++ code looks like.

Compiling

Before entering into more advenced programming, you need to understand what C++ compiling actually is.

Understanding RAM

In C++, everything is quite explicitly about storing value in the RAM and retreiving values from the RAM. To memory issues need to be clearly understand before entering the design of smart programs.

Types and syntax

Since C++-11, types are of major importance. This makes C++ very close to the binary code while still expressing computational concepts, that can be checked at compiling time. Some syntactic sugar comes with this, enabling the programmer to implement formally guided program design into an efficient language, directly linked to the execution on the processor.

LABWORK - Memory handling

Functions and exceptions

The execution thread is mainly controlled by function calls. Of course, conditional and loop statement locally enable to control the execution, but in the big picture, the execution of a program is an articulation of intricated function calls.

Definition and use of functions and exceptions.

LABWORK - lambda functions and smart pointers.

Classes

Inheritance

LABWORK - The textual formulas

Templates

LABWORK - The matrix class template

System

Extras

Past C++ tests (solutions)

Here, you will find exercises from past exams. Use them for training.

Frédéric Pennerath, Hervé Frezza-Buet,