News

Reflection voted into C++26: "Whole new language" -- Herb Sutter

The first trip report from the Sofia meeting is available:

Trip report: June 2025 ISO C++ standards meeting (Sofia, Bulgaria)

by Herb Sutter

From the article:

c26-reflection.pngA unique milestone: “Whole new language”

Today marks a turning point in C++: A few minutes ago, the C++ committee voted the first seven (7) papers for compile-time reflection into draft C++26 to several sustained rounds of applause in the room. I think Hana “Ms. Constexpr” Dusíková summarized the impact of this feature best a few days ago, in her calm deadpan way… when she was told that the reflection paper was going to make it to the Saturday adoption poll, she gave a little shrug and just quietly said: “Whole new language.”

Mic drop.

C++26: constexpr Exceptions -- Sandor Dargo

In recent weeks, we’ve explored language features and library features becoming constexpr in C++26. Those articles weren’t exhaustive — I deliberately left out one major topic: exceptions.

SANDOR_DARGO_ROUND.JPGStarting with C++26, it will become possible to throw exceptions during constant evaluation. This capability is enabled through both language and library changes. Given the significance of this feature, it deserves its own dedicated post.

C++26: constexpr Exceptions

by Sandor Dargo

From the article:

P3068R6: Allowing exception throwing in constant-evaluation

The proposal for static reflection suggested allowing exceptions in constant-evaluated code, and P3068R6 brings that feature to life.

constexpr exceptions are conceptually similar to constexpr allocations. Just as a constexpr string can’t escape constant evaluation and reach runtime, constexpr exceptions also have to remain within compile-time code.

Previously, using throw in a constexpr context caused a compilation error. With C++26, such code can now compile — unless an exception is actually thrown and left uncaught, in which case a compile-time error is still issued. But the error now provides more meaningful diagnostics.

 

CppCon 2024 The UB Detector: constexpr -- Andreas Fertig

ubdetect-fertig.pngRegistration is now open for CppCon 2025! 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 videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2025!

Lightning Talk: The UB Detector: constexpr

by Andreas Fertig

Summary of the talk:

A constexpr function evaluated at compile time is free of any undefined behaviour they say. Do you think that statement is true as well?

Talks and a first schedule for Meeting C++ 2025

This week Meeting C++ published the accepted talks and a first schedule for the conference in November.

Schedule for Meeting C++ 2025

The talks for Meeting C++ 2025

by Jens Weller

From the article:

Top 10 voted talks

    To Err is Human: Robust Error Handling in C++26 - Sebastian Theophil
    Seeing all possible paths forward - Hana Dusíková
    Code Reviews: Building Better Code and Stronger Teams - Sandor Dargo
    The Two memory Models - Anders Schau Knatten
    How to become obsolete: a guide to software engineering mentorship - Roth Michaels
    Branch Prediction: Lessons from the hot path - John Farrier
    Towards Safety and Security in C++26 - Daniela Engert
    The data-parallel types (SIMD) library in C++26 - Rainer Grimm
    The Code is Documentation Enough - Tina Ulbrich
    Range adaptors - 5 years after C++20 - Hannes Hauswedell
    Speed for free - current state of auto-vectorizing compilers - Stefan Fuhrmann

 

An option(al) to surprise you -- Andreas Fertig

me.pngIn today's post I share a learning of a customer with you. A while back, a customer asked me to join a debugging session. They had an issue they didn't (fully) understand.

An option(al) to surprise you

by Andreas Fertig

From the article:

The base

What I will show you is a much down-stripped and, of course, altered version. It was about a message system, but that's not important. Have a look at the code below.

2025-05-09_14-05-45.png

You can see a class enum for a state and a function Worker. The function takes a State and a const char* message named data. The function's job is to create a std::optional containing the user data, a C-style string.

 

CppCon 2024 Modern C++ Error Handling -- Phil Nash

modernerror-nash.pngRegistration is now open for CppCon 2025! 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 videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2025!

Modern C++ Error Handling

by Phil Nash

Summary of the talk:

We’ve had exceptions in C++ since before the first standard. C++17 introduced std::optional and C++23 std::expected (along with the so-called Monadic Operations for both types).

What should we use and when?

Meanwhile we still have older approaches, such as boolean or error code returns, as well as global or thread local error status or pointer or reference arguments.

Do these still have a place?

And where does assert fit in? And the (hopefully) upcoming contracts?

Perhaps more importantly, once we’ve examined all the trade-offs, can we defer any of those decisions to when we are best positioned to commit to them?

Erroneous conditions can have a big impact on your code’s safety and security, so error handling shouldn’t just be left to the “exercise left for the reader” in the books we used to read. Let’s get this all straight.

Implementing a Struct of Arrays -- Barry Revzin

Data-oriented design is all about reorganizing data for better performance, and Andrew Kelley’s talk on the topic—especially his use of Zig’s MultiArrayList—offered a compelling real-world example. Inspired by that, this post explores how we can achieve a similar “struct-of-arrays” approach in C++26 using reflection to build a SoaVector<T> that separates member storage for improved memory locality and performance.

Implementing a Struct of Arrays

by Barry Revzin

From the article:

Recently, I watched Andrew Kelley’s talk on Practical Data Oriented Design. It goes into some of the architectural changes he’s been making to the Zig compiler, with pretty significant performance benefit. Would definitely recommend checking out the talk, even if you’re like me and have never written any Zig.

About halfway through the talk, he shows a way to improve his memory usage by avoiding wasting memory. By turning this structure:

const Monster = struct { 
    anim : *Animation, 
    kind : Kind, 

    const Kind = enum { 
    snake, bat, wolf, dingo, human 
    }; 
}; 

var monsters : ArrayList(Monster) = .{}; 

into this one:

var monsters : MultiArrayList(Monster) = .{}; 

ArrayList(Monster) is what we could call std::vector<Monster>, and MultiArrayList(Monster) now stores the anims and kinds in two separate arrays, instead of one. That is, a struct of arrays instead of an array of structs. But it’s a tiny code change.

CppCon 2024 How Far Should You Indent Your Code? - The Number Of The Counting -- Dave Steffen

indent-steffen.pngRegistration is now open for CppCon 2025! 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 videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2025!

Lightning Talk: How Far Should You Indent Your Code? - The Number Of The Counting

by Dave Steffen

Summary of the talk:

Coding Standards have to say something about how we indent our code.  Is there a definitive answer?

C++20 Concepts for Nicer Compiler Errors -- Daniel Lemire

image-33-825x510.jpgTemplates are one of C++’s most powerful features, enabling developers to write generic, reusable code—but they come with a cost: notoriously verbose and opaque error messages. With the introduction of concepts in C++20, we can now impose clear constraints on template parameters and get far more helpful diagnostics when something goes wrong.

C++20 Concepts for Nicer Compiler Errors

by Daniel Lemire

From the article:

In C++, templates enable generic programming by allowing functions and classes to operate on different data types without sacrificing type safety. Defined using the template keyword, they let developers write reusable, type-agnostic code, such as functions (e.g., template <typename T> max(T a, T b)) or classes (e.g., std::vector), where the type T is specified at compile time.

Historically, the C++ language has tended to produce complicated compiler error messages. The main culprit is template metaprogramming. C++ templates are powerful but complex. When errors occur in template code, the compiler generates long, verbose messages with nested type information, often involving deep template instantiations. A simple mistake in a template function can produce a message spanning multiple lines with obscure type names.

Let us consider an example. In C++, we often use the ‘Standard Template Library (STL)’. It includes a useful dynamic array template: std::vector. A vector manages a sequence of elements with automatic memory handling and flexible sizing. Unlike fixed-size arrays, it can grow or shrink at runtime through operations like push_back to append elements or pop_back to remove them. You can store just about anything in an std::vector but there are some limits. For example, your type must be copyable.

Announcing the 3rd Keynote for Meeting C++ 2025: its Anthony Williams!

With this announcement the keynotes for this years Meeting C++ conference are complete!

Announcing the 3rd Keynote for Meeting C++ 2025: its Anthony Williams!

by Jens Weller

From the article:

Today I have the honor to announce that Anthony Williams completes the keynotes for Meeting C++ 2025!

Anthony Williams is well known for his book "C++ Concurrency in Action", has been an active in the committee through the BSI since 2001. He is well known for his work on concurrency and one of the architects and implementers of std::thread and other concurrency features in C++. He gave an An introduction to multithreading in C++20 at Meeting C++ 2022 in the online track. I am looking forward to welcome Anthony in person in Berlin this year!