September 2023

CppCon 2023 Surveying the Community: What Could Possibly Go Wrong? -- Anastasia Kazakova

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Surveying the Community: What Could Possibly Go Wrong?

Friday, October 6 • 10:30 - 11:30

by Anastasia Kazakova

Summary of the talk:

There are 3 major researches in C++ community nowadays. Developer Ecosystem research by JetBrains is conducted yearly, with the infographics and the raw data published for free for everyone. Since launch we learnt many insights on how to collect and process the data to get the results which are not presenting our thoughts on state of the art but close to the real world. The knowledge starts from the way to ask questions and goes to the way we interpret the answers, including the “facepalm” issues we meet yearly.

In this talk, I'll feature the results of the recent C++ community surveys, make some comparisons, and will try to showcase how to treat the differences. We'll also dive into the survey methodology aspects, learning how to remove brand, targeting and sampling biases, as well as see how a "properly" asked question changes the data in our C++ reality. This knowledge is crucial for everyone who rely on such researches and want to use them in a correct way. Come and learn how the magic numbers are collected and how to apply them to your decisions!

CppCon 2023 Finding a Purpose for Errors in Safety-Critical SYCL -- Erik Tomusk

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

The Absurdity of Error Handling: Finding a Purpose for Errors in Safety-Critical SYCL

Thursday, October 5 • 09:35 - 10:05

by Erik Tomusk

Summary of the talk:

C++ is hard. Error handling is hard. Safety-critical software is very hard. Combine the three, and you get just one of the exciting problems faced by the SYCL SC working group.

SYCL is one of the most widely supported abstraction layers for programming GPUs and other hardware accelerators using ISO C++. As of March 2023, the Khronos Group has a working group tasked with specifying SYCL SC --- a variant of SYCL that is compatible with safety-critical systems. One of the key features of a safety-critical system is that its behavior must be well understood not just in normal operation, but also in the presence of faults. This raises some difficult technical questions, such as, "How do I implement deterministic error handling?" but also some more philosophical ones, like, “What does an error actually mean, and is the error even theoretically actionable?”

Much of the information on C++ error handling in safety-critical contexts focuses on RTTI and the pitfalls of stack unwinding. Although these are important considerations, I will argue that a far greater problem is a lack of agreement on what *safety* even means. This talk will focus on how *safety* in a safety-critical context differs from *safety* from a programming language design perspective. While the talk is inspired by the pain-points of C++ error handling in safety-critical contexts, the conclusions are relevant to C++ software in general. The talk will challenge the audience to rethink the situations that can be considered erroneous and to carefully consider the expected behavior of their software in the presence of errors.

I am a member of the SYCL SC working group, but this talk will contain my own opinions.

CppCon 2023 Back to Basics: Testing -- Phil Nash

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Back to Basics: Testing

Thursday, October 5 • 09:00 - 10:00

by Phil Nash

Summary of the talk:

If we’re writing tests for our code we probably think we should write more - or write better tests. If we’re not already writing tests perhaps we think we should start. Or perhaps we are not, yet, convinced they are worth it?

This session will introduce you to the benefits of testing and how to get started and be effective.

We’ll look at:

* What does testing even mean?
* What types of testing are there, and what should I focus on?
* Should I use a test framework? If so which one?
* What are the testing best practices?
* What are some common challenges and pitfalls to overcome?

CppCon 2023 Noexcept? Enabling Testing of Contract Checks -- Halpern/Doumler

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Noexcept? Enabling Testing of Contract Checks

Wednesday, October 4 • 09:00 - 10:00

by Pablo Halpern and Timur Doumler

Summary of the talk:

Should `noexcept` be part of your function's contract? A function's *contract* is the set of pre-conditions promised by the the caller and the set of post-conditions promised by the function itself, including whether or not it throws an exception. Naively, then, it would seem that `noexcept` is a good way to indicate that your function does not throw when called in contract, but things are not so simple. In this talk, we'll review the original purpose of the `noexcept` specifier and the `noexcept` operator. We'll look at how runtime contract checks can be tested and how `noexcept` interferes with such testing. Along the way, we'll touch on the proposed contract-checking feature in C++26, eventually arriving at an alternative exception-specification annotation that would mesh far better with contract checking than `noexcept` currently does. 

CppCon 2023 Building Consensus on a Set of Rules for Our Massive C++ Codebase -- Sherry Sontag

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Building Consensus on a Set of Rules for Our Massive C++ Codebase

Friday, October 6 • 09:35 - 10:05

by Sherry Sontag

Summary of the talk:

In this talk, we will trace our efforts to build consensus across our Engineering department on how we use C++ at Bloomberg. We will use the example of how we are introducing broader naming conventions across the company’s massive C++ codebase, impacting our package management infrastructure and build tools. We will describe the lessons we’ve learned and the pitfalls we fell into as we were trying to achieve that goal, so that attendees can apply these lessons within their own organizations when introducing their own set of C++ rules.

This will also highlight the value of journalism skills in approaching engineering questions. Most important are the willingness to seek out all sides of a question; being humble enough to truly listen to even your loudest critics; and the endurance to keep asking questions until the issues become completely clear.

Our effort involved input from more than 150 people across many different application and infrastructure teams, many with different needs and coding styles. We then developed a set of rules that worked, though we also realize that the right answer will likely require ongoing flexibility.

CppCon 2023 Undefined Behavior: What Every Programmer Should Know and Fear -- Fedor Pikus

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Undefined Behavior: What Every Programmer Should Know and Fear

Thursday, October 5 • 09:00 - 09:30

by Fedor Pikus

Summary of the talk:

This talk is about You-Know-What, the thing in our programs we don’t mention by name.

What is this undefined behavior every C++ programmer has grown to fear? Just as importantly, what it isn’t? If it’s so scary, why is it allowed to exist in the language?

The aim of this talk is to approach undefined behavior rationally: without fear but with due caution. We will learn why the standard allows undefined behavior in the first place, what actually happens when a program does something the standard calls “undefined,” and why it must be taken seriously even when the program “works as-is.” As this is a practical talk, we will have live demos of programs with undefined behavior and sometimes unexpected outcomes (if you are very lucky, you might see demons fly out of the speaker’s nose). Also, as this is a practical talk, we will learn how to detect undefined behavior in one’s programs, and how to take advantage of the undefined behavior to gain better performance.

CppCon 2023 Problems and Solutions Using Coroutines In a Modern Codebase -- Francesco Zoffoli

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Coroutine Patterns and How to Use Them: Problems and Solutions Using Coroutines In a Modern Codebase

Thursday, October 5 • 09:00 - 09:30

by Francesco Zoffoli

Summary of the talk:

In over 30 years of experience the C++ community have developed patterns that are effective in writing complex systems.  The introduction of coroutines introduced a brand new paradigm, but it changes many of the assumptions of the past. In this talk we'll see common patterns and pitfals that arise using coroutines, and what solutions are needed to address them.

Based on the experience working with a heavily coroutinized codebase, this talk will show a collection of common patterns that arise using coroutines. The patterns will cover from code that the compilers today block, to effectively managing resources with RAII, to the need and risks of synchronization. It will present ways to make the code correct, workarounds to obtain the same outcome, or will warn about potential issues that can arise from such patterns.

The code shown is going to be based on Facebook's Folly implementation of coroutines, but the concepts presented are common across other implementations as well (no previous knowledge of Folly is required).

This talk is perfect for practitioners that already are trying coroutines in their codebase and want to ensure the code they're writing doesn't contain hidden bugs, but also for people that haven't used coroutines yet and they are evaluating introducing them in their codebase.

Do you want to discover the new patterns to write correct code with coroutines? Join us for this exciting talk!

Passkey Idiom: A Useful Empty Class -- Arne Mertz

logo.pngHow do you share some but not all of a class? Arne Mertz introduces the passkey idiom to avoid exposing too much with friendship.

Passkey Idiom: A Useful Empty Class

By Arne Mertz

From the article:

Let’s have a look at an example for useful empty classes. The passkey idiom can help us regain the control that we give up by simply making classes friends.

The problem with friendship

Friendship is the strongest coupling we can express in C++, even stronger than inheritance. So, we’d better be careful and avoid it if possible. But sometimes we just can’t get around giving one class more access than another.

A common example is a class that has to be created by a factory. The factory needs access to the class’s constructors. Other classes should not have that access so as not to circumvent the bookkeeping or whatever else makes the factory necessary.

The problem with the friend keyword is that it gives access to everything. There is no way to tell the compiler that the factory should not have access to any other private elements except the constructor. It’s all or nothing. 

CppCon 2023 Symbolic Calculus for High-performance Computing Using C++23 -- Vincent Reverdy

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Symbolic Calculus for High-performance Computing From Scratch Using C++23

Wednesday, October 4 • 16:45 - 17:45

by Vincent Reverdy

Summary of the talk:

Wouldn't it be nice to be able to type and manipulate symbolic mathematical formulas directly in C++? On top of providing a much more natural interface for scientists to express their ideas in code, it would constitute a particularly relevant approach to disentangle scientific application domains on one side, and high-performance computing and low-level optimizations on the other side. In this talk, we will see how building symbolic calculus tools can be achieved in plain C++23 without any compiler magic. We will see how symbolic derivatives and integrals can be computed at compile-time and we will see how the technique can be leveraged to speed-up linear algebra computations. A particular focus will be given to the concepts and to the building blocks so that the approach can be easily tweaked and adjusted to other problems, and it will be shown that the decoupling of concerns allows to combine genericity, expressivity, and high-performance in code.

In practice, we will dive into a new take on expression templates that modern C++ makes much easier to handle. In particular, we will introduce stateless formulas as a way to avoid some of the complexities that use to make traditional expression templates especially difficult to manage in codebases. We will see how Class Template Argument Deduction and unevaluated lambdas as template parameters can be combined to produce uniquely typed symbolic variables that will serve as the atoms of symbolic formulas. Implementation strategies to optimize both compile-time and runtime performance will be discussed. The talk will be illustrated with numerous examples together with their corresponding generated assembly code to show that the zero-cost abstraction principle is ensured by the set of presented techniques. Beyond the technical aspects, a broader discussion will be opened on how this approach can be combined with existing and upcoming linear algebra components of the C++ standard library (mdspan, mdarray, BLAS...) to ensure the highest level of performance when it comes to scientific computing.

The goal of this talk is really to highlight the overall strategy of implementation and the set of techniques necessary to bring symbolic calculus into high-performance code and make it as accessible as possible so that everyone can play with it. The evolution of C++ has made it much simpler to implement such things.

CppCon 2023 Optimizing Robotics Algorithms With C++'s Compile-Time Features -- Stephen Brawner

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Robotics at Compile Time: Optimizing Robotics Algorithms With C++'s Compile-Time Features

Wednesday, October 4 • 16:45 - 17:45

by Stephen Brawner

Summary of the talk:

Development of real-time software for robots allows for strategic use of compile-time programming techniques to optimize performance, latency, and memory usage. The speaker will present how template metaprogramming, the constexpr family of features, concepts and std::enable_if can benefit robotics algorithms and code through concrete examples. Beyond optimization, the speaker will discuss how these features can also enable many safety-critical checks before run-time. The speaker's goal of this talk is for attendees both in robotics and outside to learn how they may be able to move more of their software's evaluation to the compiler.

The speaker's examples will include common robotics programming tasks like kinematics, collision checking, and cartesian control. Historically, robot-agnostic software for these tasks was written to be compiled once and deployed across numerous robotics platforms. This necessitated hardware description files to be ingested on startup and then verified before operating the robot. These approaches require dynamic memory allocation, run-time polymorphism and other approaches that prevent compiler optimizations, static analysis and are not compatible with real-time operation. For many applications in robotics, however, the requirements of the robotics platform are known well in advance and can be leveraged to generate software heavily optimized by the compiler.