CppCon 2024 Compile-time Validation -- Alon Wolf

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!

Compile-time Validation

Tuesday, September 17 15:15 - 16:15 MDT

by Alon Wolf

Summary of the talk:

C++ is often criticized for its lack of inherent memory safety, but the spectrum of potential program validations extends far beyond just memory concerns. This talk delves into the necessity of early validation, emphasizing the benefits of compile-time checks in C++. By leveraging compile-time validation, developers can catch errors and enforce constraints before the code is even executed, enhancing both safety and correctness.

A functional programming approach to compile-time validation will be discussed, highlighting its benefits and demonstrating its application in ensuring code correctness.

Moreover, the talk will delve into the realm of compile-time unit tests, showcasing how they enable developers to validate code behavior at compile time, paving the way for more efficient debugging and maintenance.

Exploring advanced features, we'll discuss existing compile-time techniques to implement lifetimes, borrow checker, and other validation rules by leveraging template metaprogramming for memory safety and how they can be improved with the upcoming C++26 reflection proposal.

Additionally, we will review language extensions and compiler-specific features that augment compile-time validation capabilities. Finally, the talk will cover the role of static analysis tools in detecting potential issues early in the development process, thus complementing compile-time techniques. Attendees will gain a comprehensive understanding of the various strategies available for enhancing program reliability through compile-time validation in C++.

 

Alon is a Senior Software Engineer at Medtronic specializing in 3D and computer graphics with a passion for high performance. He has developed many custom simulation and rendering engines for different platforms using modern C++. He also writes a C++ technical blog and participates in game jams.

2024-08 Mailing Available

The 2024-08 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
N4988 Working Draft, Programming Languages -- C++ Thomas Köppe 2024-08-05 2024-08   All of WG21
N4989 Editors' Report, Programming Languages -- C++ Thomas Köppe 2024-08-05 2024-08   All of WG21
P2414R4 Pointer lifetime-end zap proposed solutions Paul E. McKenney 2024-08-12 2024-08 P2414R3 SG1 Concurrency and Parallelism
P2822R2 Providing user control of associated entities of class types Lewis Baker 2024-08-07 2024-08 P2822R1 EWG Evolution
P2897R4 aligned_accessor: An mdspan accessor expressing pointer overalignment Mark Hoemmen 2024-07-24 2024-08 P2897R3 LEWG Library Evolution,LWG Library
P2897R5 aligned_accessor: An mdspan accessor expressing pointer overalignment Mark Hoemmen 2024-08-11 2024-08 P2897R4 LEWG Library Evolution,LWG Library
P2900R8 Contracts for C++ Joshua Berne 2024-07-27 2024-08 P2900R7 EWG Evolution,LEWG Library Evolution
P2988R6 std::optional<T&> Steve Downey 2024-08-15 2024-08 P2988R5 LEWG Library Evolution,LWG Library
P2996R5 Reflection for C++26 Barry Revzin 2024-08-14 2024-08 P2996R4 EWG Evolution
P3050R2 Fix C++26 by optimizing linalg::conjugated for noncomplex value types Mark Hoemmen 2024-08-12 2024-08 P3050R1 LEWG Library Evolution
P3068R4 Allowing exception throwing in constant-evaluation Hana Dusíková 2024-08-15 2024-08 P3068R3 LEWG Library Evolution,CWG Core
P3126R2 Graph Library: Overview Phil Ratzloff 2024-08-05 2024-08 P3126R1 SG14 Low Latency,SG19 Machine Learning
P3130R2 Graph Library: Graph Container Interface Phil Ratzloff 2024-08-05 2024-08 P3130R1 SG14 Low Latency,SG19 Machine Learning
P3131R2 Graph Library: Graph Containers Phil Ratzloff 2024-08-05 2024-08 P3131R1 SG14 Low Latency,SG19 Machine Learning
P3284R1 `finally`, `write_env`, and `unstoppable` Sender Adaptors Eric Niebler 2024-07-16 2024-08 P3284R0 LEWG Library Evolution
P3315R0 2024-07 Library Evolution Poll Outcomes Inbal Levi 2024-08-15 2024-08   LEWG Library Evolution
P3325R3 A Utility for Creating Execution Environments Eric Niebler 2024-07-23 2024-08 P3325R2 LEWG Library Evolution
P3347R0 Invalid/Prospective Pointer Operations Paul E. McKenney 2024-08-09 2024-08   EWG Evolution
P3348R0 C++26 should refer to C23 not C17 Jonathan Wakely 2024-08-02 2024-08   SG6 Numerics,LEWG Library Evolution
P3361R0 Class invariants and contract checking philosophy Esa Pulkkinen 2024-07-18 2024-08   SG21 Contracts
P3361R1 Class invariants and contract checking philosophy Esa Pulkkinen 2024-07-23 2024-08 P3361R0 SG21 Contracts
P3362R0 Static analysis and 'safety' of Contracts, P2900 vs. P2680/P3285 Ville Voutilainen 2024-08-13 2024-08   EWG Evolution
P3364R0 Remove Deprecated u8path overloads From C++26 Alisdair Meredith 2024-08-15 2024-08   SG16 Unicode
P3365R0 Remove the Deprecated iterator Class Template from C++26 Alisdair Meredith 2024-08-15 2024-08   LEWG Library Evolution
P3366R0 Remove Deprecated Atomic Initialization API from C++26 Alisdair Meredith 2024-08-15 2024-08   SG1 Concurrency and Parallelism,LEWG Library Evolution
P3369R0 constexpr for uninitialized_default_construct Giuseppe D'Angelo 2024-07-28 2024-08   LEWG Library Evolution
P3370R0 Add new library headers from C23 Jens Maurer 2024-08-15 2024-08   LEWG Library Evolution
P3371R0 Fix C++26 by making the symmetric and Hermitian rank-k and rank-2k updates consistent with the BLAS Mark Hoemmen 2024-08-11 2024-08   LEWG Library Evolution,LWG Library
P3372R0 constexpr containers and adapters Hana Dusíková 2024-08-15 2024-08   LEWG Library Evolution
P3373R0 Of Operation States and Their Lifetimes Robert Leahy 2024-08-14 2024-08   LEWG Library Evolution
P3374R0 Adding formatter for fpos Liang Jiaming 2024-08-14 2024-08   LEWGI SG18: LEWG Incubator

A first look at the voting results for Meeting C++ 2024

On Sunday the voting for Meeting C++ 2024 ended, now the program is taking shape. The schedule should be available by end of August.

A first look at the voting results for Meeting C++ 2024

by Jens Weller

From the article:

And through this voting, these talks made it into the top 11 - forming the main track:

    Andreas Weis - C++ Modules - Getting Started Today
    Roth Michaels - Templates made easy with C++20: how constexpr/constexpr, fold expressions, and concepts change how we write code
    Bryce Adelstein Lelbach - The C++ Execution Model
    Klaus Iglberger - There is no Silver Bullet
    Boguslaw Cyganek - Pipeline architectures in C++: overloaded pipe operator |, std::expected and its monadic operations
    Nico Josuttis - C++ Concepts: What you should know and how to use them right
    Peter Muldoon - Dependency Injection in C++ : A Practical Guide
    Jonathan Müller - An (In-)Complete Guide to C++ Object Lifetimes
    Sandor Dargo - Clean code! Horrible performance?
    Andreas Fertig - Fast and small C++ - When efficiency matters
    Timur Doumler - Contracts for C++

CppCon 2024 Using Modern C++ to Avoid Vulnerabilities by Design -- Max Hoffmann

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!

Security Beyond Memory Safety - Using Modern C++ to Avoid Vulnerabilities by Design

Monday, September 16 11:00 - 12:00 MDT

by Max Hoffmann

Summary of the talk:

Nowadays, there is one topic that comes up in virtually all discussions on system programming languages: memory safety.
However, even though memory safety rules out many of the most common sources of vulnerabilities, there are still plenty of ways how a vulnerability may find its way into the codebase.

In this talk, we look beyond memory safety and explore how we can prevent vulnerabilities through simple yet effective C++ constructions and custom static analysis scripts. We analyze multiple examples, from basics like input validation to complex time-of-check vs time-of-use issues when accessing shared resources, all of which are inspired by real-world products, use cases, or vulnerabilities. For each example, we discuss attacker models, threats, and implementation pitfalls, before looking at potential solutions that are not just secure by themselves but also protect developers from accidentally introducing vulnerabilities in the future.

Attendees will leave with a deeper understanding of security engineering and inspirations for leveraging C++ to prevent potential security issues by design.

 

Max Hoffmann studied cybersecurity and got his Ph.D. in hardware security at the Ruhr University Bochum, Germany, in association with the Max Planck Institute for Security and Privacy at the research group of Professor Christof Paar. With a passion for teaching, he continues to contribute to the university as an external lecturer, shaping the next generation of cybersecurity professionals. As a Security Manager at ETAS, he oversees the Onboard Security portfolio, driving process improvements, supporting in technical discussions, managing vulnerabilities, and enhancing security awareness in the organization.

What to do if you don't want a default constructor? -- Sandor Dargo

SANDOR_DARGO_ROUND.JPGDo we need a default constructor? What does it mean to have a default constructor? What happens if we don’t have one? Those are the questions we are going after in this article.

What to do if you don't want a default constructor?

by Sandor Dargo

From the article:

A default constructor is a constructor that takes no arguments and initializes - hopefully - all the members with some default values. If you define no constructors at all, it’ll even be generated for you.

Do we need default constructors?

It really depends. Let’s first approach this question from a design point of view. Does it make sense to represent an object where the members are default initialized?

If you represent a tachograph, it probably makes sense to have such a default state where all the counters are initialized to zero.

The tachograph is the device that records driving times and rest periods as well as periods of other work and availability taken by the driver of a heavy vehicle.

On the other hand, if you represent a person or a task identifier - which inspired me to write this article - it doesn’t. A person with an empty name or a task ID with an empty ID doesn’t make much sense.

Well, that’s the case from a design point of view. What about the technical aspects? What happens if we don’t have a default constructor?

CppCon 2024 Template-less Meta-programming -- Kris Jusiak

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!

Template-less Meta-programming

Friday, September 20 09:00 - 10:00 MDT

by Kris Jusiak

Summary of the talk:

Meta-programming is one of the most significant C++ superpowers. It enables seemingly impossible feats, but there is a considerable cost associated with it as well. Therefore, its applications have been limited to experts and cases where the benefits greatly outweigh the maintenance burden.

But what if that doesn't have to be the case? In this talk, we will explore an alternative approach to template meta-programming that does not require an understanding of the traditional 'angle bracket' technique.

We will also make the case that anyone who can write C++ can become a meta-programming guru! But what about compilation times and/or testing/debugging, you may ask? Well, we will cover those as well, and it might be surprising what modern C++ is actually capable of!

Additionally, we will cover how the static reflection proposal and C++20 ranges can further improve the ability to write meta-functions and how C++ compares to other languages such as circle. However, we will also show how to apply the technique with C++17 on all major compilers with a ready-to-go solution.

Finally, we will benchmark compilation times of different approaches, showcasing their strengths and weaknesses.

If you are interested in meta-programming or have always wanted to understand its practical use cases but never really grasped them, this talk is for you!

 

Kris is a passionate Software Engineer with experience across various industries, including telecommunications, gaming, and most recently, finance. He specializes in modern C++ development, with a keen focus on performance and quality. Kris is also an active conference speaker and open-source enthusiast, having created multiple open-source libraries.

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.