CppCon 2022 Reflection in C++ - Past, Present, and Hopeful Future -- Andrei Alexandrescu

cppcon-2022-reflection-in-cpp-past-present-and-hopeful-future-andrei-alexan.pngRegistration 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 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 2023!

Reflection in C++ - Past, Present, and Hopeful Future

by Andrei Alexandrescu

Summary of the talk:

Aspect Oriented Programming. Metaobject protocols. Intentional programming. AspectC++. OpenC++. C++ metaclasses. Reflection and related technologies already has a long history in the theory and practice of several programming languages, including C++. However, the lofty promises of the 1990s (user-defined language semantics, infinite configurability, ultimate code reuse) failed to materialize in mainstream success.

Within the standard C++ realm, a reflection proposal has had a long and meandering road that is finally converging. Will it be successful? Why is this time different? And most importantly, what's in it for the community - what compelling applications are at the horizon to justify the addition to an already large language core?

This talk explores these questions and several related others. Although you won't take home code and insights that you can put to work tomorrow, you will acquire something that is less urgent but arguably more important: a vision of a better way of writing programs. Think generic programming without the pain, high-leverage generic code, seamless integration with foreign languages, and much more.

 

CppCon 2022 find-move-candidates in Cpp -- Chris Cotter

cppcon-2022-find-move-candidates-in-cpp-chris-cotter.pngRegistration 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 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 2023!

Lightning Talk: find-move-candidates in C++

by Chris Cotter

Summary of the talk:
A clang tool to automatically find code that should use std::move to reduce unnecessary copies.

Bitwise Binary Search: Elegant and Fast -- Orson Peters

peters-bitwisebinarysearch.png

I recently read the article Beautiful Branchless Binary Search by Malte Skarupke. In it they discuss the merits of the following snippet of C++ code implementing a binary search.

Bitwise Binary Search: Elegant and Fast

by Orson Peters

From the article:

In this article I will provide an alternative implementation based on similar ideas but with a very different interpretation that is (in my opinion) incredibly elegant and clear to understand, at least as far as binary searches go. The resulting implementation also saves a comparison in almost every case and ends up quite a bit smaller.

Dealing with Sharing -- Rainer Grimm

temp_file_DealingwithSharing-Grimm1.pngIf you don’t share, no data races can happen. Not sharing means that your thread works on local variables. This can be achieved by copying the value, using thread-specific storage, or transferring the result of a thread to its associated future via a protected data channel.

Dealing with Sharing

by Rainer Grimm

From the article:

The patterns in this section are quite obvious, but I will present them with a short explanation for completeness. Let me start with Copied Value. If a thread gets its arguments by copy and not by reference, there is no need to synchronize access to any data. No data races and no lifetime issues are possible.

Data Races with References

The following program creates three threads. One thread gets its argument by copy, the other by reference, and the last by...

CppCon 2022 Finding the Average of 2 Integers -- Tomer Vromen

cppcon-2022-finding-the-average-of-2-integers-tomer-vromen.pngRegistration 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 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 2023!

Lightning Talk: Finding the Average of 2 Integers

by Tomer Vromen

Summary of the talk:

I'm going to discuss the (a+b)/2 problem - not the midpoint problem (for which Marshal is an expert) but rather the one with a possibly fractional result. It will be a quick taste of the limits of using floating points to represent integers.

Concurrency Patterns -- Rainer Grimm

There are many well-established patterns used in the concurrency domain. They deal with synchronization challenges such as sharing and mutation but also with concurrent architectures. Today, I will introduce and dive deeper into them in additional posts.

Concurrency Patterns

by Rainer Grimm

From the article:

The main concern when you deal with concurrency is shared, mutable state or, as Tony Van Eerd put it in his CppCon 2014 talk “Lock-free by Example”: “Forget what you learned in Kindergarten (ie stop Sharing)”. A crucial term for concurrency is a data race. Let me first define this term.

  • Data race: A data race is when at least two threads access a shared variable simultaneously. At least one thread tries to modify the variable. If your program has a data race, it has undefined behavior. This means all outcomes are possible, so reasoning about the program makes no sense anymore.

A necessary condition for a data race is a mutable, shared...

Mutating Through a Filter -- Barry Revzin

MutatingThroughaFilter.pngNico Josuttis gave a talk recently that included an example and I wanted to explain what’s going on in this example, what the issue is, and what (if anything) is broken.

Mutating Through a Filter

by Barry Revzin

From the article:

As with a lot of my explanations, we have to start from the beginning.

The C++ iterator model has a number of iterator categories: input, forward, bidirectional, random access, and (since C++20) contiguous. This post only needs to consider the first two.

An input range (a range whose iterator is an input iterator) is a single-pass range. You can only ever call begin() one time on it. You can’t have multiple different input iterators into the same range - incrementing one immediately invalidates any existing copies.

CppCon 2022 How Microsoft Uses C++ to Deliver Office - Huge Size, Small Components -- Zachary Henkel

cppcon-2022-how-microsoft-uses-cpp-to-deliver-office-huge-size-small-compon.pngRegistration 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 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 2023!

How Microsoft Uses C++ to Deliver Office - Huge Size, Small Components

by Zachary Henkel

Summary of the talk:

Office is one of the largest and longest-lived C++ codebases in the world. Over 40 years Office has evolved from a single application written in C for DOS to a product containing over 100M lines of C++ code targeting more than a dozen platforms. What are the implications of growing to this size and what sort of engineering is required? In this talk I’ll give a glimpse behind the curtain on the C++ engineering and architecture in Office. In addition to sharing some details on the scale of Office, I’ll describe the design and coding standards used to create well-factored components that we have termed liblets.

CppCon 2022 Back to Basics: C++ API Design -- Jason Turner

cppcon-2022-back-to-basics-cpp-api-design-jason-turner.pngRegistration 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 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 2023!

Back to Basics: C++ API Design

by Jason Turner

Summary of the talk:

Let’s face it: writing a C++ API can be a daunting task. You recognize that APIs are a critical aspect of your code, and you’d like to provide your users with a great experience, but how?

This talk will focus on one key aspect: "Making APIs Hard to Use Wrong." How do we design APIs that help, instead of hurt, our users?