May 2023

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?

How To Check If A Pointer Is In A Range Of Memory -- Raymond Chen

RaymondChenPic.pngC language was defined to cover a large range of computer architectures, including many which would be considered museum relics today. It therefore takes a very conservative view of what is permitted, so that it remains possible to write C programs for those ancient systems. (Which weren’t quite so ancient at the time.)

How To Check If A Pointer Is In A Range Of Memory

by Raymond Chen

From the article:

Suppose you have a range of memory described by two variables, say,

byte* regionStart;
size_t regionSize;

And suppose you want to check whether a pointers lies within that region. You might be tempted to write

if (p >= regionStart && p < regionStart + regionSize)

but is this actually guaranteed according to the standard?

2023-05 Mailing Available

The 2023-05 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
N4946 2024-03 Tokyo meeting information JF Bastien 2023-04-13 2023-05 All of WG21
N4947 INCITS C++/WG21 agenda: 12-17 June 2023, Varna, Bulgaria John Spicer 2023-05-02 2023-05 All of WG21
N4948 Working Draft, C++ Extensions for Library Fundamentals, Version 3 Thomas Köppe 2023-05-08 2023-05 All of WG21
N4949 Editor's Report: C++ Extensions for Library Fundamentals, Version 3 Thomas Köppe 2023-05-08 2023-05 All of WG21
N4950 Working Draft, Standard for Programming Language C++ Thomas Köppe 2023-05-10 2023-05 All of WG21
N4951 Editors' Report - Programming Languages - C++ Thomas Köppe 2023-05-10 2023-05 All of WG21
N4953 Concurrency TS2 Michael Wong 2023-05-15 2023-05 All of WG21
N4954 2023 WG21 admin telecon meetings, rev. 1 Herb Sutter 2023-05-18 2023-05 All of WG21
P0342R2 pessimize_hint Gonzalo Brito Gadeschi 2023-05-16 2023-05 P0342R1 SG1 Concurrency and Parallelism
P0447R22 Introduction of std::hive to the standard library Matt Bentley 2023-05-16 2023-05 P0447R21 SG14 Low Latency,LEWG Library Evolution,All of WG21
P0843R6 static_vector Gonzalo Brito Gadeschi 2023-05-18 2023-05 P0843R5 LEWG Library Evolution
P1000R5 C++ IS schedule Herb Sutter 2023-05-10 2023-05 P1000R4 All of WG21
P1028R5 SG14 status_code and standard error object Niall Douglas 2023-05-11 2023-05 P1028R4 LEWG Library Evolution
P1061R5 Structured Bindings can introduce a Pack Barry Revzin 2023-05-17 2023-05 P1061R4 EWG Evolution
P1068R7 Vector API for random number generation Ilya Burylov 2023-05-17 2023-05 P1068R6 LEWG Library Evolution
P1112R4 Language support for class layout control Pal Balog 2023-05-18 2023-05 P1112R3 EWG Evolution
P1144R8 std::is_trivially_relocatable Arthur O'Dwyer 2023-05-14 2023-05 P1144R7 EWG Evolution,LEWG Library Evolution
P1684R5 mdarray: An Owning Multidimensional Array Analog of mdspan Christian Trott 2023-05-19 2023-05 P1684R4 LEWG Library Evolution
P1759R6 Native handles and file streams Elias Kosunen 2023-05-17 2023-05 P1759R5 LWG Library
P1885R12 Naming Text Encodings to Demystify Them Corentin Jabot 2023-04-05 2023-05 P1885R11 LWG Library
P1901R2 Enabling the Use of weak_ptr as Keys in Unordered Associative Containers Daryl Haresign 2023-04-05 2023-05 P1901R1 LWG Library
P1928R4 std::simd - Merge data-parallel types from the Parallelism TS 2 Matthias Kretz 2023-05-19 2023-05 P1928R3 LEWG Library Evolution
P2019R3 Thread attributes Corentin Jabot 2023-05-18 2023-05 P2019R2 LEWG Library Evolution
P2022R2 Rangified version of lexicographical_compare_three_way Ran Regev 2023-05-10 2023-05 P2022R1 SG9 Ranges,LEWG Library Evolution
P2141R1 Aggregates are named tuples Antony Polukhin 2023-05-03 2023-05 P2141R0 LEWG Library Evolution,LWG Library
P2300R7 `std::execution` Eric Niebler 2023-04-21 2023-05 P2300R6 LEWG Library Evolution,LWG Library
P2447R4 std::span over an initializer list Arthur O'Dwyer 2023-05-14 2023-05 P2447R3 LEWG Library Evolution
P2495R3 Interfacing stringstreams with string_view Michael Hava 2023-04-19 2023-05 P2495R2 LWG Library
P2500R1 C++ parallel algorithms and P2300 Ruslan Arutyunyan 2023-05-17 2023-05 P2500R0 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2546R4 Debugging Support René Ferdinand Rivera Morell 2023-05-20 2023-05 P2546R3 LEWG Library Evolution,LWG Library
P2548R5 copyable_function Michael Florian Hava 2023-04-03 2023-05 P2548R4 LEWG Library Evolution,LWG Library
P2552R2 On the ignorability of standard attributes Timur Doumler 2023-05-19 2023-05 P2552R1 EWG Evolution,CWG Core
P2561R2 A control flow operator Barry Revzin 2023-05-18 2023-05 P2561R1 EWG Evolution
P2621R3 UB? In my Lexer? Corentin Jabot 2023-05-18 2023-05 P2621R2 CWG Core
P2637R2 Member visit Barry Revzin 2023-05-15 2023-05 P2637R1 LEWG Library Evolution
P2641R3 Checking if a union alternative is active Barry Revzin 2023-05-15 2023-05 P2641R2 LEWG Library Evolution
P2643R1 Improving C++ concurrency features Gonzalo Brito Gadeschi 2023-05-18 2023-05 P2643R0 SG1 Concurrency and Parallelism
P2654R0 Modules and Macros Alisdair Meredith 2023-05-19 2023-05 EWG Evolution,LEWG Library Evolution
P2662R1 Pack Indexing Corentin Jabot 2023-05-18 2023-05 P2662R0 EWG Evolution
P2663R2 Proposal to support interleaved complex values in std::simd Daniel Towner 2023-04-28 2023-05 P2663R1 LEWG Library Evolution
P2663R3 Proposal to support interleaved complex values in std::simd Daniel Towner 2023-05-17 2023-05 P2663R2 LEWG Library Evolution
P2664R2 Proposal to extend std::simd with permutation API Daniel Towner 2023-04-28 2023-05 P2664R1 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2664R3 Proposal to extend std::simd with permutation API Daniel Towner 2023-05-17 2023-05 P2664R2 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2685R1 Language Support For Scoped Objects Alisdair Meredith 2023-05-19 2023-05 P2685R0 EWGI SG17: EWG Incubator
P2686R1 constexpr structured bindings and references to constexpr variables Corentin Jabot 2023-05-18 2023-05 P2686R0 EWG Evolution,CWG Core
P2689R2 atomic_accessor Nevin Liber 2023-05-25 2023-05 P2689R1 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2717R1 Tool Introspection René Ferdinand Rivera Morell 2023-05-17 2023-05 P2717R0 SG15 Tooling
P2727R2 std::iterator_interface Zach Laine 2023-05-03 2023-05 P2727R1 LEWG Library Evolution
P2728R1 Unicode in the Library, Part 1: UTF Transcoding Zach Laine 2023-05-04 2023-05 P2728R0 SG16 Unicode,LEWG Library Evolution
P2728R2 Unicode in the Library, Part 1: UTF Transcoding Zach Laine 2023-05-10 2023-05 P2728R1 SG16 Unicode,LEWG Library Evolution
P2728R3 Unicode in the Library, Part 1: UTF Transcoding Zach Laine 2023-05-10 2023-05 P2728R2 SG16 Unicode,LEWG Library Evolution
P2741R2 user-generated static_assert messages Corentin Jabot 2023-05-11 2023-05 P2741R1 EWG Evolution
P2746R2 Deprecate and Replace Fenv Rounding Modes Hans Boehm 2023-05-14 2023-05 P2746R1 SG6 Numerics,LEWG Library Evolution
P2748R1 Disallow Binding a Returned Glvalue to a Temporary Brian Bi 2023-05-15 2023-05 P2748R0 EWG Evolution
P2752R2 Static storage for braced initializers Arthur O'Dwyer 2023-05-14 2023-05 P2752R1 EWG Evolution,CWG Core
P2757R2 Type checking format args Barry Revzin 2023-05-15 2023-05 P2757R1 LEWG Library Evolution
P2767R0 flat_map/flat_set omnibus Arthur O'Dwyer 2023-05-14 2023-05 LWG Library
P2769R1 get_element customization point object Ruslan Arutyunyan 2023-05-17 2023-05 P2769R0 SG9 Ranges,LEWG Library Evolution
P2771R1 Towards memory safety in C++ Thomas Neumann 2023-05-17 2023-05 P2771R0 SG23 Safety and Security
P2774R0 Scoped thread-local storage Michael Florian Hava 2023-05-10 2023-05 SG1 Concurrency and Parallelism
P2775R0 2023-05 Library Evolution Polls Bryce Adelstein Lelbach 2023-05-25 2023-05 LEWG Library Evolution
P2781R1 std::constexpr_v Zach Laine 2023-05-04 2023-05 P2781R0 LEWG Library Evolution
P2781R2 std::constexpr_v Zach Laine 2023-05-21 2023-05 P2781R1 LEWG Library Evolution
P2786R1 Trivial relocatability options Mungo Gill 2023-05-19 2023-05 P2786R0 EWGI SG17: EWG Incubator,EWG Evolution
P2811R2 Contract Violation Handlers Joshua Berne 2023-04-20 2023-05 P2811R1 SG21 Contracts
P2811R3 Contract Violation Handlers Joshua Berne 2023-05-04 2023-05 P2811R2 SG21 Contracts
P2811R4 Contract Violation Handlers Joshua Berne 2023-05-15 2023-05 P2811R3 SG21 Contracts
P2814R0 Trivial Relocatability --- Comparing P1144 with P2786 Mungo Gill 2023-05-19 2023-05 EWGI SG17: EWG Incubator,LEWGI SG18: LEWG Incubator
P2821R1 span.at() Jarrad J. Waterloo 2023-04-13 2023-05 P2821R0 SG23 Safety and Security,LEWG Library Evolution
P2828R1 Copy elision for direct-initialization with a conversion function (Core issue 2327) Brian Bi 2023-05-11 2023-05 P2828R0 CWG Core
P2829R0 Proposal of Contracts Supporting Const-On-Definition Style Andrew Tomazos 2023-04-12 2023-05 SG21 Contracts
P2831R0 Functions having a narrow contract should not be noexcept Timur Doumler 2023-05-15 2023-05 LEWG Library Evolution
P2834R0 Semantic Stability Across Contract-Checking Build Modes Joshua Berne, John Lakos 2023-05-15 2023-05 SG21 Contracts
P2835R0 Expose std::atomic_ref's object address Gonzalo Brito Gadeschi 2023-05-18 2023-05 SG1 Concurrency and Parallelism
P2837R0 Planning to Revisit the Lakos Rule Alisdair Meredith 2023-05-19 2023-05 LEWG Library Evolution
P2839R0 Nontrivial relocation via a new "owning reference" type Brian Bi 2023-05-15 2023-05 EWGI SG17: EWG Incubator
P2841R0 Concept Template Parameters Corentin Jabot 2023-05-18 2023-05 EWG Evolution
P2842R0 Destructor Semantics Do Not Affect Constructible Traits Alisdair Meredith 2023-05-19 2023-05 LWG Library
P2843R0 Preprocessing is never undefined Alisdair Meredith 2023-05-19 2023-05 SG16 Unicode
P2845R0 Formatting of std::filesystem::path Victor Zverovich 2023-05-07 2023-05 SG16 Unicode,LEWG Library Evolution
P2846R0 size_hint: Eagerly reserving memory for not-quite-sized lazy ranges Corentin Jabot 2023-05-11 2023-05 SG9 Ranges
P2848R0 std::is_uniqued Arthur O'Dwyer 2023-04-24 2023-05 LEWGI SG18: LEWG Incubator
P2850R0 Minimal Compiler Preserved Dependencies Mark Batty 2023-05-15 2023-05 SG1 Concurrency and Parallelism
P2852R0 Contract violation handling semantics for the contracts MVP Tom Honermann 2023-04-24 2023-05 SG21 Contracts
P2853R0 Proposal of std::contract_violation Andrew Tomazos 2023-05-10 2023-05 SG21 Contracts
P2855R0 Member customization points for Senders and Receivers Ville Voutilainen 2023-05-18 2023-05 LEWG Library Evolution
P2857R0 P2596R0 Critique Matt Bentley 2023-04-28 2023-05 All of WG21
P2858R0 Noexcept vs contract violations Andrzej Krzemieński 2023-05-12 2023-05 SG21 Contracts
P2861R0 The Lakos Rule: Narrow Contracts And `noexcept` Are Inherently Incompatible John Lakos 2023-05-18 2023-05 SG21 Contracts,EWG Evolution,LEWG Library Evolution
P2862R0 text_encoding::name() should never return null values Daniel Krügler 2023-05-09 2023-05 LEWG Library Evolution,LWG Library
P2863R0 Review Annex D for C++26 Alisdair Meredith 2023-05-19 2023-05 EWG Evolution,LEWG Library Evolution
P2864R0 Remove Deprecated Arithmetic Conversion on Enumerations From C++26 Alisdair Meredith 2023-05-19 2023-05 EWG Evolution
P2865R0 Remove Deprecated Array Comparisons from C++26 Alisdair Meredith 2023-05-19 2023-05 EWG Evolution
P2866R0 Remove Deprecated Volatile Features From C++26 Alisdair Meredith 2023-05-19 2023-05 EWG Evolution
P2867R0 Remove Deprecated strstreams From C++26 Alisdair Meredith 2023-05-19 2023-05 LEWG Library Evolution
P2868R0 Remove Deprecated `std::allocator` Typedef From C++26 Alisdair Meredith 2023-05-19 2023-05 LEWG Library Evolution
P2869R0 Remove Deprecated `shared_ptr` Atomic Access APIs From C++26 Alisdair Meredith 2023-05-19 2023-05 SG1 Concurrency and Parallelism
P2870R0 Remove `basic_string::reserve()` From C++26 Alisdair Meredith 2023-05-19 2023-05 LEWG Library Evolution
P2871R0 Remove Deprecated Unicode Conversion Facets From C++26 Alisdair Meredith 2023-05-19 2023-05 SG16 Unicode
P2872R0 Remove `wstring_convert` From C++26 Alisdair Meredith 2023-05-19 2023-05 LEWG Library Evolution
P2873R0 Remove Deprecated locale category facets for Unicode from C++26 Alisdair Meredith 2023-05-19 2023-05 SG16 Unicode
P2874R0 Mandating Annex D Alisdair Meredith 2023-05-19 2023-05 LWG Library
P2875R0 Undeprecate `polymorphic_allocator::destroy` For C++26 Alisdair Meredith 2023-05-19 2023-05 LEWG Library Evolution
P2876R0 Proposal to extend std::simd with more constructors and accessors Daniel Towner 2023-05-18 2023-05 LEWG Library Evolution
P2878R0 Reference checking Jarrad J. Waterloo 2023-05-10 2023-05 SG23 Safety and Security
P2878R1 Reference checking Jarrad J. Waterloo 2023-05-18 2023-05 P2878R0 SG23 Safety and Security
P2880R0 Algorithm-like vs std::simd based RNG API Ilya Burylov 2023-05-18 2023-05 LEWG Library Evolution
P2881R0 Generator-based for loop Jonathan Müller 2023-05-18 2023-05 EWGI SG17: EWG Incubator,EWG Evolution
P2882R0 An Event Model for C++ Executors Detlef Vollmann 2023-05-11 2023-05 SG1 Concurrency and Parallelism
P2883R0 `offsetof` Should Be A Keyword In C++26 Alisdair Meredith 2023-05-19 2023-05 EWGI SG17: EWG Incubator
P2884R0 `assert` Should Be A Keyword In C++26 Alisdair Meredith 2023-05-19 2023-05 EWGI SG17: EWG Incubator,SG21 Contracts,SG22 Compatability
P2886R0 Concurrency TS2 Editor's report Michael Wong 2023-05-15 2023-05 All of WG21
P2887R0 SG14: Low Latency/Games/Embedded/Finance/Simulation virtual meeting minutes to 2023/05/11 Michael Wong 2023-05-15 2023-05 SG14 Low Latency
P2888R0 SG19: Machine Learning Virtual Meeting Minutes to 2023/05/12 Michael Wong 2023-05-15 2023-05 SG19 Machine Learning
P2889R0 Distributed Arrays Lauri Vasama 2023-05-15 2023-05 EWGI SG17: EWG Incubator,EWG Evolution
P2891R0 SG16: Unicode meeting summaries 2023-01-11 through 2023-05-10 Tom Honermann 2023-05-16 2023-05 SG16 Unicode
P2892R0 std::simd Types Should be Regular David Sankel 2023-05-18 2023-05 LEWG Library Evolution
P2893R0 Variadic Friends Jody Hagins 2023-05-19 2023-05 EWGI SG17: EWG Incubator
P2895R0 noncopyable and nonmoveable utility classes Sebastian Theophil 2023-05-17 2023-05 LEWG Library Evolution
P2897R0 aligned_accessor: An mdspan accessor expressing pointer overalignment Mark Hoemmen 2023-05-18 2023-05 LEWGI SG18: LEWG Incubator
P2898R0 Importable Headers are Not Universally Implementable Daniel Ruoso 2023-05-18 2023-05 SG15 Tooling
P2901R0 Extending linear algebra support to batched operations Mark Hoemmen 2023-05-19 2023-05 SG6 Numerics,LEWGI SG18: LEWG Incubator,SG19 Machine Learning

CppCon 2022 10 Tips for Cleaner C++ 20 Code -- David Sackstein

cppcon-2022-10-tips-for-cleaner-cpp-20-code-david-sackstein.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!

10 Tips for Cleaner C++ 20 Code

by David Sackstein

Summary of the talk:

The objective of this session is to provide guidelines and tips that will help the audience write readable, testable and extensible code with modern C++.
One of the greatest challenges we face, as programmers, is to make sure that our code can be understood and used by our colleagues - and not only by the compiler.
As the complexity of C++ increases, the compiler is able to deduce and optimize more of our code, but often at the cost of making it more obscure for our colleagues. Code that is difficult to read is difficult to test, to maintain and to extend.
In the session, I propose to help the audience understand the core problems that we introduce as our programming becomes more advanced, and how we can avoid them. The main part of the session will discuss some fairly complex and advanced C++ code which is difficult to understand. I will then demonstrate 10 easily applicable tips to make it easier to understand and to test. The benefits will be clearly evident.
There will also be a short discussion with the audience to increase the confidence that the guidelines and the tips are readily applicable in their own diverse projects.

More than a rehash – Joaquín M. López in Madrid at Using std::cpp

In this talk, Joaquín will invite you to look under boost::unordered_flat_map's hood with him and learn about this container's data structure, its key design elements and how it compares with other top-performance C++ hashmaps both in theory and in practice.

More than a rehash – Joaquín M. López in Madrid at Using std::cpp
by Joaquín M. López

From the talk:

Boost 1.81 (Dec 2022) released boost::unordered_flat_map, a hashmap (unordered associative container in C++ parlance) that relies on open addressing and SIMD techniques to provide extremely high performance. In this talk, Joaquín will invite you to look under boost::unordered_flat_map's hood with him and learn about this container's data structure, its key design elements and how it compares with other top-performance C++ hashmaps both in theory and in practice. The talk finishes with a teaser on concurrent hashmaps arriving as part of your Boost update later this year. Deck and note can be found here