Coordinator: Prof. Antonio Vicino
Home |  DIISM |   | Login Privacy e Cookie policy



Modern C++ For High-performance And Effective Programming


Sandro Bartolini
University of Siena - Dipartimento di Ingegneria dell'Informazione e Scienze Matematiche
Course Type
Group 1
18-22/6 h. 14:00-18:00 lab. 124
How C++11/14/17 can help every programmer to quickly write efficient, correct and maintainable code for modern computer architectures

C++ is and has always been the most suitable language for seeking high-performance, resource-efficiency, low-latency while dominating application complexity through a rich set of zero-overhead abstractions (e.g. through object orientation). Many application domains take full advantage from C++: finance, operating systems, simulation and modeling, real-time systems, multimedia elaboration, high-performance computing (HPC), embedded systems, videogames, ...

Since 2011 revision of the standard, a three-year standardization cycle has started in which, incrementally, various innovations have been integrated to promote performance, expressiveness, simplification and productivity, error-avoidance, parallel programming, if used correctly. All of this happens within an international standardization process that guarantees its portability across processors and platforms over time.

Since 2011 standard, C++ ships improvements that enrich the language and fit so well together that the inventor of C++ commented that "it feels like a new language" and observed that individual novelties can be extremely beneficial to every programmer, also the ones using only a subset of the language.

The main objective of the course is to highlight the new available tools and methods of C++ (2011/14/17 standards) that all programmers, from the least to most experienced one, can exploit in order to code more effectively, seeking high-performance while making less errors and promoting reuse.
For instance, "never again" explicit management of dynamic memory (i.e. new and delete) for leak-free applications, "never again" raw for-loops if existing STL algorithms and other strategies can avoid them, so that correctness can be enforced, and so on.
The course encourages new modern C++ programming techniques along with the indication of which old C++ features should not be used anymore, even if still available in the standard for backward compatibility. The course aims to highlight a modern way of programming in C++ that can be extremely useful to everyone needing high-performance and high-efficiency on modern architectures.
“Within C++, there is a much smaller and cleaner language struggling to get out.” Bjarne Stroustrup, the inventor of C++

The course will go through the following major steps:
1) introduction to the major innovations of C++11/14/17: move semantics and related concepts, lambda expressions, range-for loop, 'auto', constant expressions, structured binding, compile-time if. All these concepts will be illustrated in insulation as well as in an integrated fashion to highlight their aggregate potential. Other smaller, but still important, innovations will be addressed along the way. For instance, scoped enumerations, uniform initialization, etc.
2) innovations in the Standard Template Library (STL) both in the data structures and in the standard algorithms, in order to promote modular, effective and error-free programming. In this phase, we will discuss and highlight also the effects and innovations deriving from the previously introduced basic concepts. Specifically, after recalling and consolidating the effective use of traditional STL containers and algorithms, we will address the new ones. Then smart-pointers will be addressed along with the concepts needed for memory-leak programming. RAII and exception-safe programming will be introduced. Some other standard libraries will be highlighted along the way: for example for time management, random-number generation, etc.
3) fundamentals of parallel programming through the standard C++11/14/17 constructs. We will expose a few approaches for easily and reliably harnessing the processing power of modern multi-core processors. From parallel algorithms of c++17-STL up to threads and asynchronous procedures.

We will critically discuss the benefits and limitations of each addressed topic as to promote clearer, more efficient, correct and portable coding.

The course will follow a very practical approach that will alternate the presentation of topics and features, also through live-coding, and immediate practical experimentation on the computer.



PhD Students/Alumni

Dip. Ingegneria dell'Informazione e Scienze Matematiche - Via Roma, 56 53100 SIENA - Italy