Blog

Silent foe or quiet ally: Brief guide to alignment in C++. Part 3 -- Elizaveta Zhegalova

We continue our deep dive into memory mechanics. If you are just joining us, I recommend reviewing the foundations first. The first part covered the basics and the magic of simple data alignment, while the second part focused on how ordinary inheritance affects memory layout.

Silent foe or quiet ally: Brief guide to alignment in C++. Part 3

by Elizaveta Zhegalova

From the article:

So far, we've treated an object as a static, rigidly determined data structure. Every field address was known at compile time, and inheritance simply layered parent and child attributes. Alas, object-oriented programming is impossible without dynamic polymorphism, which is implemented in C++ via the RTTI mechanism and virtual functions.
 
What is virtuality?
Let me start from an off-topic question. How does the compiler know which piece of machine code to execute at a specific line in your program? Answering this question will help us understand what virtuality really means.
 
Imagine we write object.print(). For the processor, it's not an abstract action but a command to jump to a certain address in memory with some function instructions. But where do we take that address from?
 
During compilation, each code line becomes one or more machine instructions, each receives a unique sequential address in memory. The same applies to functions. A compiler translates them into machine code and assigns the next available address. Stitching a function call in code to its actual memory address is called binding.
 
Depending on when the call address is bound to the function address, there are two scenarios.
 
1. Static/early binding.
 
By default, static (early) binding is used. A compiler rigidly "hardwires" a specific function address at the call place in code during compilation. This decision relies solely on the pointer or reference type, not the actual object in memory. For instance, when a compiler sees a Base* pointer, it chooses the method address from the base class. It's fast and requires no additional evaluations. So, the jump goes to an already known address. It's also efficient, but it makes the program inflexible at runtime.
 

"C++23 - The Complete Guide" draft ebook is out -- Nicolai Josuttis

I am happy to announce that my new book in the "The Complete Guide" series is out now as a draft ebook

C++23 - The Complete Guide

by Nicolai Josuttis

So far, the book has 350 pages and is not complete yet. However, many C++23 features are covered already. For details of the current content, look at www.cppstd23.com. There you can also find several example programs demonstrating how all the new features can be used.

You can order the book at leanpub.com/cpp23 for a reduced price and will get all updates for free. This way, you have early access to details of the new features and I have early income and can process feedback from you for the final version, which will also be available as hardcover (not included).

I hope it helps. Enjoy!

 

 

CppCon's first-ever keynote panel: Stroustrup, van Rossum, and Torgersen, together at CppCon 2026

Every year, CppCon promises you a strong keynote lineup, and every year we deliver. But this year we get to do something rarer: announce a once-in-a-lifetime keynote panel of interest not just to C++ developers, but to our whole industry.

On Tuesday morning, September 15, the CppCon main stage will host a Language Designers Panel featuring three of the people who decide what the languages you use every day actually become:

  • Bjarne Stroustrup, the creator of C++ (who will have just given his own Monday conference kickoff keynote the day before)
  • Guido van Rossum, the creator of Python
  • Mads Torgersen, the lead designer of C# and Anders Hejlsberg’s successor in that role
  • Moderator: Emma Tracey, founder of CultRepo and producer of its new feature film C++: The Documentary and Python: The Documentary

Three living and growing languages used by millions of developers, three design philosophies, one stage, one conversation.

Bjarne and Guido have never been on stage together anywhere and may never be again; add Mads to the stage, and we expect this special moment to be watched, cited, and argued over for years. You can be in the room when it happens.

Why should a C++ audience care about a panel that is two-thirds “other languages”? The answer is that these languages are two of C++’s closest neighbors and are used together all the time.

  • Python is, by the numbers, C++’s truest sister language. In the Standard C++ Foundation’s annual C++ developer survey, when we ask which other languages C++ programmers use, Python always comes first, consistently around 70 percent — ahead even of C, which you might expect to win and is consistently around 45 percent. If you write C++, the odds are very good that you also write Python; the two have grown up side by side, gluing and being glued, and the relationship only deepens each year.
  • C# and C++ are the two dominant languages on Windows, and the two are constantly used together — native performance underneath, managed productivity on top — so the person designing C# is designing part of the world that a great many C++ developers ship into.

So this is a conversation among the architects of the three languages most of us actually live in. What do they envy in one another’s designs? Where do they think they got it right, and where would they start over? How do you steer a language with millions of users and decades of existing code without breaking the people who depend on you? And the lessons to learn from their shared experience reach well beyond language design — the same instincts that shape a language will sharpen how you design your own libraries and products. Bring your own questions, too — you will not get a chance like this often.

CppCon 2026 Early Bird registration discount is available until this Friday. After that, registration will continue to be available at the regular rate. CppCon 2026 runs September 12–18 at the Gaylord Rockies in Aurora, Colorado, and conference sessions are onsite-only this year — they will be recorded and posted to our YouTube channel afterward, but only the room gets the live experience and the chance to ask questions of all our speakers. If you have been waiting to register, this is the week to stop waiting.

Register now for CppCon 2026, and we’ll see you in Aurora.

BeCPP Symposium 2026 - Keith Stockdale - The journey to "/W4 /WX": How hard could it be?

BeCPP Symposium 2026 (organized by BeCPP): Now on YouTube!

Keith Stockdale - The journey to "/W4 /WX": How hard could it be?

Abstract:

Building on the recent work of improving the quality of Sea of Thieves' codebase by upgrading from C++14 to C++20, this talk will focus on the work that has went into enabling warnings as errors on the game, and more. Rare will discuss the motivations behind wanting to crank up the warning level, and to flick the "warnings as errors" switch after 10 years of development in their multi-million line Unreal Engine code base.

About the Speaker:

Keith is a Northern Irish senior software engineer who has been working on the Engine and Rendering teams at Rare Ltd for the last 9 years. He primarily works on Engine and Rendering level systems involving General Purpose GPU systems such as GPU particle systems. Keith is enthusiastic about promoting writing good quality code, whether it is running on the CPU on the GPU.

 

BeCPP Symposium 2026 - Chris Croft-White - Agentic Time-Travel Debugging

BeCPP Symposium 2026 (organized by BeCPP): Now on YouTube!

Chris Croft-White - Agentic Time-Travel Debugging

Abstract:

Time-travel debugging is a powerful technique to dive deep into the execution of your applications, providing visibility simply not available any other way and enabling rapid diagnosis of issues as well as understanding of unfamiliar code bases. With the AI revolution going on today, hallucinations are a major concern and limiting factor for adoption. Combining these two technologies enables us to give the AI Agent all the information it could possibly want about what happened in your application. This enables it to both investigate when something goes wrong to develop a hypothesis, but also a way to validate that hypothesis, and iterate on it as needed until the AI Agent is able to verifiably explain what happened and why.

About the Speaker:

Chris Croft-White is a Staff Solutions Architect at Undo, where he works at the intersection of debugging technology and developer productivity. With a career spanning field applications engineering, security, and technical pre-sales, he brings a practitioner's perspective to the challenge of helping engineering teams ship reliable software faster. Chris is currently focused on the emerging field of agentic debugging, exploring how AI can move beyond code generation to become a genuine partner in root cause analysis and defect resolution. He writes and speaks on practical approaches to integrating AI into real-world debugging workflows, cutting through the hype to find what actually works.

 

CppCon 2025 Lazy and Fast: Ranges Meet Parallelism in C++ -- Daniel Anderson

anderson-lazy.pngRegistration is now open for CppCon 2026! The conference starts on September 12 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 2026!

Lazy and Fast: Ranges Meet Parallelism in C++

by Daniel Anderson

Summary of the talk:

Recent advances in the C++ standard have introduced powerful features like ranges and parallel algorithms—both aimed at writing faster, cleaner, and more expressive code. Ranges offer lazy, on-demand computation that improves I/O efficiency and composability. Parallel algorithms, on the other hand, harness multitasking to speed up compute-heavy workloads.

At first glance, these two features seem like a perfect match: lazy evaluation to minimize I/O overhead, and parallelism to maximize throughput. However, in practice, they don’t play well together. Many range operations—especially those over non-random-access sources—are inherently sequential due to their lazy pull-based, one-element-at-a-time nature.

In this talk, we’ll explore a modern library technique that unlocks the synergy between lazy ranges and parallelism. You’ll see how to build lazy, composable range pipelines that are parallel-friendly—capable of efficiently expressing operations like filter, scan, and flatten without sacrificing performance or elegance. We’ll walk through real-world examples where these techniques deliver strong parallel speedups with minimal programming overhead.

Whether you’re a library designer, performance enthusiast, or just curious about making your range-based code scale, this talk will equip you with practical tools to bridge the gap between composability and parallelism in modern C++.

C++26: string and string_view improvements -- Sandor Dargo

SANDOR_DARGO_ROUND.JPGLet’s continue our exploration of C++26 improvements. Today we focus on string_view. Some types got new constructors accepting string_views, and concatenation of strings and string_views just got easier.

C++26: string and string_view improvements

by Sandor Dargo

From the article:

But let’s start with a brief reminder of what a string_view is.

Reminder: the role of string_view

std::string_view was introduced in C++17 and its purpose is to provide read-only access to a string-like object. It can often replace const string& parameters and offers a significant performance gain. It’s generally advisable to use it whenever you’d pass an immutable string-like input that you cannot move from source to target.

We covered the topic earlier in more depth here.

P2495R3: Interfacing stringstreams with string_view

A stringstream is a good old tool for dealing with operations on string-based streams. While C++23 introduced spanstreams, due to fundamental semantic differences, stringstreams are not dead and it’s important to maintain them.

Being a good old tool also means they predate string_view. Given the available set of constructors, if you want to initialize a stringstream from a string_view, you first have to manually convert it into a string.

P2495R3 fixes this by adding new constructors accepting string_views.

It’s worth noting that this is a purely additive library change — it doesn’t break existing code.

At the moment of publication, this change is already available on Clang 19.

CppCon 2025 How to Tame Packs, std::tuple, & the Wily std::integer_sequence -- Andrei Alexandrescu

alexandrescu-tame.pngRegistration is now open for CppCon 2026! The conference starts on September 12 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 2026!

How to Tame Packs, std::tuple, and the Wily std::integer_sequence

by Andrei Alexandrescu

Summary of the talk:

Template parameter packs and std::tuple unlock powerful metaprogramming capabilities in C++, but they also introduce a parallel sublanguage—one with unfamiliar rules, verbose idioms, and surprising limitations. Packs were originally designed for perfect forwarding, not compile-time iteration, which makes even simple tasks like filtering or transformation awkward. std::integer_sequence helps, but mostly by shifting the burden rather than removing it.

Existing library utilities offer some relief, but often feel inconsistent and difficult to compose. This talk explores why working with packs and tuples feels harder than it should, and demonstrates a small set of clean, reusable abstractions that make these tasks simpler, safer, and more expressive. Attendees will leave with practical tools—(and, with luck, a renewed hope) that structured metaprogramming in C++ doesn't have to be so hard.

New features in GCC 16: Improved error messages and SARIF output -- David Malcolm

redhatgraphic.pngGCC 16 is about to be released, so I'm sharing some of the new features I worked on this year. Some changes are visible to users, while others improve the system more subtly.

New features in GCC 16: Improved error messages and SARIF output

by David Malcolm

From the article:

A well-known challenge for C++ developers is the readability of template-related error messages. C++ compilers tend to either provide too little information or spew screenfuls of text at you. Either way, the errors can be difficult to decipher.

GCC error messages have a hierarchical structure to them. In GCC 15, I added an experimental option that shows this structure as a collection of nested bullet points.

In GCC 16, this behavior is now the default. You can return to the previous behavior using -fno-diagnostics-show-nesting or -fdiagnostics-plain-output. I fixed several bugs and made use of the hierarchical structure in more places. For example, it is easy to get declarations and definitions out of sync when manually adding const to a parameter:

class foo
{
  public:
    void test(int i, int j, void *ptr, int k);
};
    
// Wrong "const"-ness of param 3.
void foo::test(int i, int j, const void *ptr, int k)
{
}

Trip report: June 2026 ISO C++ standards meeting (Brno, Czechia) -- Herb Sutter

Hot off the press from the latest ISO C++ meeting:

Trip report: June 2026 ISO C++ standards meeting (Brno, Czechia)

by Herb Sutter

From the article:

tl;dr… A few highlights

  • Adopted this week in draft C++29: Complete catalog of all undefined behavior (UB) in C++. Contract pre/post support for virtual functions. Defaulting (=default) for postfix increment/decrement. Designated initializers for base classes. Python-style .lookup(key) for associative containers. And more…
  • Other significant progress: Progress on various features targeting C++29, including systematically addressing UB and adding safety profiles for C++.
  • Next six months: Telecon line-by-line review of a proposal to systematically address all undefined behavior in C++. Progress adding C++ memory safety subsetting profiles. Both aim for inclusion in C++29.