August 2024

CppCon 2024 Deciphering C++ Coroutines - Mastering Asynchronous Control Flow -- Andreas Weis

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Deciphering C++ Coroutines - Mastering Asynchronous Control Flow

Thursday, September 19 09:00 - 10:00 MDT

by Andreas Weis

Summary of the talk:

One of the most powerful applications of coroutines is in the context of asynchronous operations, where their use allows for significant simplifactions of application code. Unfortunately, building an asynchronous library interface to enable such benefits for applications is not exactly straightforward in C++.

In this talk we will explore the essentials of managing asynchronous control flow with coroutines. We will discover how to reconstruct the call stack of nested asynchronous calls and thus bridge a significant gap between C++'s stackless coroutines and the stackful coroutines from other languages. We will learn how to build a mechanism similar to the async/await from languages like Python or Javascript for our own libraries. And we will explore how we can perform arbitrary manipulations of the call stack in such an environment to unleash the full power of C++'s coroutine mechanism.

At the end of this talk we will have a proper understanding of how the Task<> type found in many coroutine libraries works and how it can be used to manage asynchronous operations. This will serve as an important building block for understanding more advanced mechanisms, like the sender/receiver mechanism proposed for C++26.

This talk assumes basic familiarity with the components of the C++ coroutines language feature: promises, awaitables, coroutine handles, and passing data in and out of coroutines.

This is the second part in an ongoing series of talks about C++20 coroutines.

 

Andreas Weis has been writing C++ code in many different domains, from real-time graphics, to distributed applications, to embedded systems. As a library writer by nature, he enjoys writing portable code and exposing complex functionalities through simple, richly-typed interfaces. Both of which C++ allows him to do extensively.Andreas is also one of the co-organizers of the Munich C++ User Group, which allows him to share this passion with others on a regular basis.

CppCon 2024 Designing a Slimmer Vector of Variants -- Christopher Fretz

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Designing a Slimmer Vector of Variants

Wednesday, September 18 14:00 - 15:00 MDT

by Christopher Fretz

Summary of the talk:

Heterogeneous containers ("vectors of variants") are an extremely flexible and useful abstraction across many data domains, but std::vector<std::variant<...>> can exhibit extremely bad memory characteristics for mixed types of disparate size, especially if the largest types are relatively uncommon in practice. Variants always have to be at least as large as their largest contained type, and vector implicitly requires all of its members to be the same size, leading to significant bloat in such cases. Motivated by real-world use-cases, this talk explores the design of a bit-packed replacement data structure that can achieve massive improvements in memory usage, and the impacts that these optimizations have on its API.

CppCon 2024 Shared Libraries and Where to Find Them -- Luis Caro Campos

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Shared Libraries and Where to Find Them

Tuesday, September 17 • 14:00 - 15:00 MDT

by Luis Caro Campos

Summary of the talk:

Most C++ developers are familiar with the type of errors that arise when a shared library is not found. If they are really unlucky, they are have also faced a situation where the the wrong version of a library is loaded. However, a lot of us resort to suboptimal solutions just to get going, without fully addressing the root causes.

A lot of the time, we focus on the “build” process, that is, producing our binaries and executables. But getting the runtime linker/loader to locate the right libraries (and the right versions!) has a unique set of challenges that  should not be overlooked - after all, running the executables is critical for running tests, continuous integration, and obviously end-users running our apps and services.

Managing dependencies continues to be one of the top frustrations of C++ developers as per the most recents ISO C++ Developer Surveys. When it comes to shared libraries - different applications try to locate them at different times: the build system (e.g. CMake or Autotools) when configuring the build, the linker at build time, and the dynamic linker/loader at runtime.

This talk will cover in detail the different scenarios in which shared libraries need to be located, and how this is handled by package managers, build systems, and the the OS level. Emphasis will be placed on familiarizing the developer with the relevant tooling across multiple platforms, as well as associated concepts (e.g. RPATHs).

An often overlooked aspect will also be covered: how to create a self-contained, relocatable bundle for our user-facing applications, decoupled from the developer environment, as opposed to “works on my machine”.

 

Luis is a Electronics and Computer Engineer based in the UK, with previous experience as a C++ engineer in the field of Computer Vision and Robotics. With a passion to enable C++ engineers to develop at scale following modern DevOps practices. He is currently part of the Conan team at JFrog, focused on the problems of the C++ community at large.

CppCon 2024 Bridging the Gap: Writing Portable Programs for CPU and GPU -- Thomas Mejstrik

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Bridging the Gap: Writing Portable Programs for CPU and GPU

Monday, September 16 • 15:15 - 16:15 MDT

by Thomas Mejstrik

Summary of the talk:

This talk presents a series of effective patterns to address challenges arising when
code is developed that shall operate seamlessly on both GPU (Cuda) and CPU environments.
This scenario is a common oversight among Cuda developers, given the substantial architectural differences between CPUs and GPUs.

The patterns presented cover a range of scenarios, from handling stray function calls, strategies for conditional compilation, exploiting constexpr functions, leveraging undefined behaviour, usage of Cuda specific macros,
conditional instantiation of templates, and managing compiler warnings and errors.

Key patterns include: "Host device everything", "Conditional function body", "Constexpr everything", "Disable the warnings", "Defensive Programming", "Conditional Host Device Template", and "Function dispatching".

We evaluate each pattern based on ease of use, maintenance overhead, applicability and known usages. Additionally, pitfalls to avoid and considerations for implementations are provided to guide developers in adopting these patterns effectively.

 

Thomas Mejstrik earned his doctoral degree in Mathematics from the University of Vienna, Austria, specializing in numerical linear algebra and high-performance computing. Additionally, he obtained a Master's degree in Piano Education from the University of Music and Performing Arts Vienna, Austria. He also pursued studies in Chinese at the Central China Normal University, Wuhan, China, and the University of Vienna, Austria. With prior experience as a CUDA/C++ Senior Software Developer at Dimetor, Vienna, Austria, Thomas Mejstrik currently serves as a Postdoctoral Researcher at the University of Vienna, leading a research project on linear subdivision schemes, particularly relevant in animation. Beyond his academic and professional pursuits in mathematics, programming, and music, Thomas Mejstrik is actively involved in various women's political initiatives.

CppCon 2024 Reflection Based Libraries to Look Forward To -- Saksham Sharma

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Reflection Based Libraries to Look Forward To

Tuesday, September 17 • 09:00 - 10:00 MDT

by Saksham Sharma

Summary of the talk:

The primary reason for your code to get bored is fatigue from repetitive instructions. You write down enums, but then you also have to write their stringified version, and you also have to write a function to map the strings to the enums. You write down a class, but you have to expose every method / member in the class separately to be able to bind your class to a Python program (for example).
Reflection is (potentially / hopefully) showing up for C++26, having already been forwarded from the SG7 subgroup on reflection / compile time programming to the LEWG and EWG. This talk will discuss everything there is so far on reflection, and we will lead up to three library ideas based on reflection:

Python bindings
ABI hashing (hashing a type for efficient compatibility checking)
A better std::any variant type with duck typing ��
Come attend this talk if you'd like to hear about cool new library possibilities that have opened up with reflection!

For background, we will look at a little bit of context and how reflection works in some other languages, and will explore how the P2996R1 paper’s proposed version of reflection looks in practice, with some real use-case inspired code.

 

Saksham Sharma is a Director of Quantitative Research Technology at Tower Research Capital LLC, a high frequency trading firm based out of New York. He develops low latency and high throughput trading systems and strategies used for the firm's global quantitative trading. In addition, he also helps design and improve big data research infrastructure used for trading research using a combination of C++ and Python. Thanks to an urge to optimize his daily workflow, he also owns the build systems, tooling, and package managers for C++ within his team.In the past, he has worked in the fields of program analysis research, functional programming, and systems security. He is a reformed geek (exemplified by a switch to VSCode after almost a decade with Emacs), and now enjoys driving, guitar, badminton, and snowboarding.

22 Common Filesystem Tasks in C++20 -- Bartlomiej Filipek

Filipek-22common.pngWorking with the filesystem can be a daunting task, but it doesn’t have to be. In this post, I’ll walk you through some of the most common filesystem operations using the powerful features introduced in C++17, as well as some new enhancements in C++20/23. Whether you’re creating directories, copying files, or managing permissions, these examples will help you understand and efficiently utilize the std::filesystem library.

22 Common Filesystem Tasks in C++20

by Bartlomiej Filipek

From the article:

Creating directories is a basic yet essential operation. The std::filesystem library makes this straightforward with the create_directory function.

Filipek-22common2.png

CppCon 2024 Taming the C++ Filter View -- Nicolai Josuttis

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Taming the C++ Filter View

Tuesday, September 17 • 16:45 - 17:45 MDT

by Nicolai Josuttis

Summary of the talk:

C++20 introduced "views" as easy-to-use building blocks for processing the elements and values of containers and ranges.
The filter view is one of the key views, because filtering collections of data to process only elements that satisfy a specific constraint or requirement is one of the most important use cases of dealing with ranges and views.

Unfortunately, the filter view is also one of the most surprising C++ standard views. Even for simple use cases, you can easily get:
- Unexpected functional behavior
- Surprising compile-time errors with cryptic error messages
- Fatal runtime errors (without even noticing them)

There are reasons for the design of the filter view. For a successful filtering of elements you should know and understand the design and all of its consequences.

The talk will demonstrate all the issues with simple real-work examples and explain both the motivation and consequences if this design in practice. Listen and learn aspects you would not expect but have to know when using the filter views and views in general.

 

Nicolai Josuttis (www.josuttis.com) is well-known in the community for his authoritative books and talks. For more than 20 years he has been a member of the C++ Standard Committee. He is the author of several worldwide best-sellers, including:- C++20: The Complete Guide- C++17: The Complete Guide- C++ Move Semantics: The Complete Guide- The C++ Standard Library: A tutorial and Reference- C++ Templates: The Complete Guide (w/ David Vandevoorde & Doug Gregor)

CppCon 2024 Implementing Ranges and Views -- Roi Barkan

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

Implementing Ranges and Views

Wednesday, September 18 • 16:45 - 17:45 MDT

by Roi Barkan

Summary of the talk:

Since `ranges` were introduced to C++20, a new paradigm was presented to us C++ developers. This paradigm, [sequence oriented programming](https://cppcast.com/sequence_oriented_programming/) allows easy expression of useful algorithms, helps us decompose problems into smaller-clearer sub-problems and has the potential of increasing the readability and maintainability of solutions we develop to difficult problems.

Though rich and diverse, the set of tools in our `ranges` toolbox is at its infancy, and the robust design of the library makes it possible for us to extend it with algorithms and views on our own. Doing so can increase our productivity, enrich our vocabulary and also be fun and challenging.

In this talk I'll discuss the structure of the ranges library in terms of its main `concept`s and how it was designed to be extensible (especially as on C++23).

We will focus on the implementation `range views`, and go over several examples of how new views which aren't part of the standard should be designed and implemented, in a way that fits with the rest of the `ranges` library.

Join me in the development of range adapters as we learn about range categories, concepts, adapters, customization-point-objects and range-adapter-closures.

 

Professional software developer and architect since 2000, Roi's main focus throughout his career was on high performance and distributed systems, implementing complex and innovative algorithms. Roi is the SVP technologies of Istra Research, where he helps creating low latency financial systems. Prior to working for Istra Research, Roi spent 12 years in software development, architecture and management in the IT Security field. Roi received his B.A in Computer Science with high honors from the Technion in Israel, and his executive MBA from Tel Aviv University.

CppCon 2024 C++/Rust Interop: Using Bridges in Practice -- Tyler Weaver

Registration is now open for CppCon 2024! The conference starts on September 15 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 2024!

C++/Rust Interop: Using Bridges in Practice

Friday, September 20 • 10:30 - 11:30 MDT

by Tyler Weaver

Summary of the talk:

A practical guide to bridging the gap between C++ and Rust. We cover bindings, including a manual approach, and compare them with generated bindings using CXX.  We also show how to link CMake with Cargo and link with transitive C++ dependencies using Conan.

 

Tyler Weaver has been writing C++ for 10 short years in multiple domains. He's worked on signal processing, robotics, and now back-end web development at SciTec.

C++ programmer's guide to undefined behavior: part 3 of 11

Your attention is invited to the third part of an e-book on undefined behavior. This is not a textbook, as it's intended for those who are already familiar with C++ programming. It's a kind of C++ programmer's guide to undefined behavior and to its most secret and exotic corners. The book was written by Dmitry Sviridkin and edited by Andrey Karpov.

C++ programmer's guide to undefined behavior: part 3 of 11

by Dmitry Sviridkin

From the article:

This program, built by GCC 10.1, -std=c++20 -O3, doesn't crash, but it doesn't output anything either. If we take GCC 14.1 and the same keys, we suddenly get "helloworld" in the output. It's old but gold undefined behavior.