Back to Basics: const and constexpr – Rainer Grimm – CppCon 2021

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
It is a virtue to program as const as possible in modern C++. Your program is by design way more type safe, has fewer concurrency issues, and runs with high probability faster.

Const has many flavors in modern C++. Thanks to const, you can protect a value against mutation. With constexpr, you can initialize and compute values at compile time. Thanks to conteval, a computation can only run at compile time. In the end, constinit empowers you to initialize a modifiable value at compile time.

Let me show you in my lecture how you can initialize a value with constexpr and constinit in a thread-safe way. Let me show you how const and constexpr help you protect values from mutation and, therefore, make them immune to data races. Finally, let me show you how constexpr and consteval empowers you to improve the performance of your program and get functions that are by design easy to test, easy to maintain, and implicitly thread-safe.

---
Rainer Grimm

I've worked as a software architect, team lead, and instructor since 1999. In 2002, I created company-intern meetings for further education. I have given training courses since 2002. My first tutorials were about proprietary management software, but I began teaching Python and C++ soon after. In my spare time, I like to write articles about C++, Python, and Haskell. I also like to speak at conferences. I publish weekly on my English blog (https://www.modernescpp.com/) and the (https://www.grimm-jaud.de/index.php/blog), hosted by Heise Developer. Since 2016 he is an independent instructor giving seminars about modern C++ and Python. Rainer published several books in various languages to modern C++ and concurrency, C++20, and the C++ Core Guidelines, in particular. Due to his profession, Rainer always searches for the best way to teach modern C++

---
Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

No comment yet, add your voice below!


Add a Comment