Design and Implementation of Highly Scalable Quantifiable Data Structures - CppCon 2021--Victor Cook

Registration is now open for CppCon 2022, which starts on September 11 and will again be held both in person and online. 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 2022 to attend in person, online, or both!

Design and Implementation of Highly Scalable Quantifiable Data Structures in C++

by Victor Cook

Summary of the video:

Architectural imperatives due to the slowing of Moore's Law, the broad acceptance of relaxed semantics and the O(n!) worst case verification complexity of generating sequential histories motivate a new approach to concurrent correctness. Quantifiability is proposed as a novel correctness condition that models a system in vector space to launch a new mathematical analysis of concurrency. Analysis is facilitated with linear algebra, better supported and of much more efficient time complexity than traditional combinatorial methods.

In this talk, we present the design and implementation of a lock-free quantifiable stack (QStack) and a lock-free quantifiable queue (QQueue) in the C++ programming language. Our design achieves lock-freedom using compare_exchange_strong from the C++17 Atomic Operations Library. We depict several code snippets that illustrate how quantifiable data structures are highly scalable through use of relaxed semantics, an explicit implementation trade-off permitted by quantifiability. We explain how to reason about the correctness of quantifiable data structures and present a technique and a dynamic analysis tool developed in C++ for efficiently verifying a concurrent history as quantifiably correct, referred to as Vector Space Verification (VSV). We illustrate why it is impractical to use alternative verification techniques that compare concurrent histories to sequential histories for determining correctness for real programs.

We showcase the performance of quantifiable data structures by presenting a live demonstration that runs the QStack and QQueue and plots the results in real time. The QStack is compared with the lock-free Elimination Backoff Stack and the lock-free Treiber stack. The QQueue is compared with the lock-free LCRQ, and the wait-free Fetch-And-Add queue. The live performance demonstration illustrates how the QStack and QQueue achieve substantially higher scalability than the state-of-the-art linearizable counterparts. We also present a live demonstration of our VSV tool to dynamically check a concurrent history for the QStack and QQueue as quantifiably correct in less than O(n^2) time.

C++23’s Deducing this: what it is, why it is, how to use it

Useful new feature!

C++23’s Deducing this: what it is, why it is, how to use it

by Sy Brand

From the article:

Deducing this (P0847) is a C++23 feature which gives a new way of specifying non-static member functions. Usually when we call an object’s member function, the object is implicitly passed to the member function, despite not being present in the parameter list. P0847 allows us to make this parameter explicit, giving it a name and const/reference qualifiers...

Data Orientation For The Win! - Eduardo Madrid - CppCon 2021

Registration is now open for CppCon 2022, which starts on September 11 and will again be held both in person and online. 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 2022 to attend in person, online, or both!

Data Orientation For The Win!

by Eduardo Madrid

Summary of the video:

C++ conferences have had presentations showing the important performance benefits of data-oriented design principles; however, the principles seem to require lots of "manual" effort and "code uglification"; these make the principles less practical, and there haven't been clear recommendations about how to deal with runtime-polymorphic types.

In this talk we will recapitulate on data orientation principles and their benefits showing their application through production-strength Generic Programming components made to support them.

Specific examples include:
1. Structures of arrays instead of arrays of complex structures (a.k.a. "scattering")
2. Support for data oriented designs for runtime-polymorphism without inheritance+virtual (the equivalent of using std::variant or std::function, but generalized as allowed by the Zoo type-erasure framework)
----1. Hybrid buffers: the equivalent of the virtual table pointer is scattered out of the objects solving the "Goldilocks problem" of how big the local buffer should be, objects occupy the available space optimally
----2. Easy (de)serialization through very easy relocatability
----3. Voiding the need for pointers in favor of indices into arrays

Pass-by-value vs Pass-by-reference--James Mitchell

Complex world.

Pass-by-value vs Pass-by-reference

by James Mitchell

From the article:

Let’s dig into the age old question, should you pass-by-value or pass-by-reference in C++? (or by pointer in C)

This blog post is mostly a re-post of a reddit comment that I made on r/cpp about pass-by-value and pass-by-reference, with some minor improvements, to make it easier to reference and save.

The answer isn’t as easy as it might seem, it depends on the Application Binary Interface (ABI) and your use-cases, there isn’t a one size fits all answer, this is even more the case for anything which is built to be cross platform.

First it’s probably good to break the problem down into two parts (focusing solely on performance, ignoring readability and maintainability which should often be more important)

  • The language construct costs (copying, moving, etc)
  • Compiler implications (aliasing, pointer provenance, etc)
  • The ABI (the stack, registers, etc)...

Porting my first application from Qt5 to Qt6

An overview on the issues face when porting my first application to Qt6

Porting my first Application from Qt5 to Qt6

by Jens Weller

From the article:

Just this week I had the opportunity to recompile one of my Qt Applications to build it with Qt6. Here is some of the results.

The application in question manages parts of the conference, and hence is written in Qt for the UI and uses SQLite as datastorage, so Qt also used for this and as I learned for a few other things too...

CppCon 2022 Keynote: Contemporary C++ in Action -- Daniela Engert

The third CppCon 2022 keynote has been announced! Daniela Engert is the world's top guru on C++ modules who isn't one of the compiler implementers, and will speaking about modules and so much more:

Daniela Engert live in person at CppCon 2022

Daniela Engert will be in Aurora, live in person to deliver a keynote that takes us on a journey through modern C++.

Daniela has been building computers and creating software for over forty years, with thirty years in the field of applied digital signal processing. Her recent focus has been on modules and helping developers best understand them and their application in C++20.

Here is her talk description:

Contemporary C++ in Action

This talk is different from typical conference presentations. Instead of focussing on one particular topic I want to take you with me on a journey where I put various pieces from the C++ landscape together into a small application and show how they fit together beautifully. My goal is to debunk the myth that the committee is looking to please experts and library developers instead of making life easier for the many developers in the trenches. This is not slideware, at the end of our tour the code will compile and run with some entertaining result.

On this journey, I will be visiting modules (using modularized popular libraries and others that constitute the app), do some network programming with coroutines (based on ASIO executors, as there are no C++ standard executors yet), slip in one or two of the flagship C++23 features, like explicit object parameters or some of the new library stuff, and season the stew with items from recent C++ standards. It’s a tiny application using techniques that an average programmer in the embedded or industrial world (like me) might find useful. The code I’ll show also contains very tiny fragments of condensed or simplified sources in active development taken from our in-house codebase – old and trusted, but thrust into the modern age.

Registration is now open so don’t miss out on CppCon 2022 this September 11-16. Register today! Tickets are now available for both online attendees and in-person attendees.

2022-07 Mailing Available

The 2022-07 mailing of new standards papers is now available.

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup
P0009R18 MDSPAN Christian Trott 2022-07-13 2022-07 P0009R17 All of WG21
P1018R17 C++ Language Evolution status pandemic edition  2022/06–2022/07 JF Bastien 2022-07-09 2022-07 P1018R16 EWG Evolution,All of WG21
P1083R6 Move resource_adaptor from Library TS to the C++ WP Pablo Halpern 2022-07-08 2022-07 P1083R5 LEWG Library Evolution
P1255R8 A view of 0 or 1 elements: views::maybe Steve Downey 2022-07-11 2022-07 P1255R7 SG9 Ranges,LEWG Library Evolution
P1642R11 Freestanding Library: Easy [utilities], [ranges], and [iterators] Ben Craig 2022-07-01 2022-07 P1642R10 CWG Core
P1684R3 mdarray: An Owning Multidimensional Array Analog of mdspan Christian Trott 2022-07-14 2022-07 P1684R2 LEWG Library Evolution
P1899R3 stride_view Christopher Di Bella, Tim Song 2022-07-10 2022-07 P1899R2 SG9 Ranges,LEWG Library Evolution
P1967R8 #embed - a simple, scannable preprocessor-based resource acquisition method JeanHeyd Meneide 2022-06-28 2022-07 P1967R7 EWG Evolution
P2047R3 An allocator-aware optional type Nina Ranns 2022-07-08 2022-07 P2047R2 LEWG Library Evolution
P2079R3 System execution context Lee Howes 2022-07-15 2022-07 P2079R2 SG1 Concurrency and Parallelism,LEWG Library Evolution
P2165R4 Compatibility between tuple, pair and tuple-like objects Corentin Jabot 2022-07-15 2022-07 P2165R3 LEWG Library Evolution
P2248R5 Enabling list-initialization for algorithms Giuseppe D'Angelo 2022-06-29 2022-07 P2248R4 SG6 Numerics,SG9 Ranges,LEWG Library Evolution
P2295R6 Support for UTF-8 as a portable source file encoding Corentin Jabot 2022-07-01 2022-07 P2295R5 SG22 Compatability,EWG Evolution
P2361R5 Unevaluated strings Corentin Jabot 2022-07-09 2022-07 P2361R4 EWG Evolution
P2374R4 views::cartesian_product Sy Brand 2022-07-13 2022-07 P2374R3 LWG Library
P2404R3 Move-only types for equality_comparable_with, totally_ordered_with, and three_way_comparable_with Justin Bassett 2022-07-08 2022-07 P2404R2 SG9 Ranges,LEWG Library Evolution,LWG Library
P2417R2 A more constexpr bitset Daniil Goncharov 2022-07-16 2022-07 P2417R1 LWG Library
P2419R2 Clarify handling of encodings in localized formatting of chrono types Victor Zverovich 2022-07-15 2022-07 P2419R1 LWG Library
P2460R2 Relax requirements on wchar_t to match existing practices Corentin Jabot 2022-07-15 2022-07 P2460R1 SG22 Compatability,CWG Core
P2474R2 views::repeat Michał Dominiak 2022-07-13 2022-07 P2474R1 SG9 Ranges,LWG Library
P2481R1 Forwarding reference to specific type/template Barry Revzin 2022-07-15 2022-07 P2481R0 EWG Evolution
P2494R2 Relaxing range adaptors to allow for move only types Michał Dominiak 2022-07-13 2022-07 P2494R1 SG9 Ranges,LWG Library
P2513R4 char8_t Compatibility and Portability Fix JeanHeyd Meneide 2022-06-26 2022-07 P2513R3 EWG Evolution
P2547R1 Language support for customisable functions Lewis Baker 2022-07-16 2022-07 P2547R0 EWG Evolution
P2548R0 copyable_function Michael Florian Hava 2022-07-13 2022-07   LEWG Library Evolution
P2549R1 std::unexpected should have error() as member accessor Yihe Li 2022-07-04 2022-07 P2549R0 LWG Library
P2561R0 operator?? Barry Revzin 2022-07-10 2022-07   EWG Evolution
P2579R0 Mitigation strategies for P2036 "Changing scope for lambda trailing-return-type" Corentin Jabot 2022-07-01 2022-07   EWG Evolution,CWG Core
P2585R1 Improving default container formatting Barry Revzin 2022-07-15 2022-07 P2585R0 LEWG Library Evolution
P2587R1 to_string or not to_string Victor Zverovich 2022-06-24 2022-07 P2587R0 SG16 Unicode
P2590R2 Explicit lifetime management Timur Doumler 2022-07-15 2022-07 P2590R1 CWG Core,LWG Library
P2592R1 Hashing support for std::chrono value classes Giuseppe D'Angelo 2022-06-30 2022-07 P2592R0 LEWG Library Evolution
P2601R1 Make redundant empty angle brackets optional Justin Cooke 2022-07-16 2022-07 P2601R0 EWG Evolution,CWG Core
P2602R1 Poison Pills are Too Toxic Barry Revzin 2022-07-11 2022-07 P2602R0 LEWG Library Evolution
P2609R1 Relaxing Ranges Just A Smidge John Eivind Helset 2022-06-29 2022-07 P2609R0 SG9 Ranges,LEWG Library Evolution
P2610R0 2022-07 Library Evolution Polls Bryce Adelstein Lelbach 2022-06-29 2022-07   LEWG Library Evolution
P2613R1 Add the missing `empty` to `mdspan` Yihe Le 2022-06-29 2022-07 P2613R0 LEWG Library Evolution
P2614R0 Deprecate numeric_limits::has_denorm Matthias Kretz 2022-07-06 2022-07   SG6 Numerics,LEWG Library Evolution
P2615R0 Meaningful exports S. Davis Herring 2022-07-01 2022-07   CWG Core
P2616R0 Making std::atomic notification/wait operations usable in more situations Lewis Baker 2022-07-05 2022-07   SG1 Concurrency and Parallelism
P2617R0 Responses to NB comments on DTS 12907 "Extensions to C++ for Transactional Memory Version 2" Jens Maurer 2022-07-15 2022-07   SG5 Transactional Memory,CWG Core
P2618R0 C++ Standard Library Issues to be moved in Virtual Plenary, Jul. 2022 Jonathan Wakely 2022-07-15 2022-07   All of WG21
P2620R0 Lifting artificial restriction on universal character names Corentin Jabot 2022-07-09 2022-07   SG16 Unicode,SG22 Compatability,EWG Evolution
P2621R0 UB? In my Lexer? Corentin Jabot 2022-07-09 2022-07   SG22 Compatability,EWG Evolution
P2622R0 Core Language Working Group "ready" Issues for the July, 2022 meeting Jens Maurer 2022-07-15 2022-07   All of WG21
P2623R0 implicit constant initialization Jarrad J. Waterloo 2022-07-13 2022-07   EWG Evolution
P2624R0 Make operations on bools more portable Justin Cooke 2022-07-16 2022-07   CWG Core

CWE Top 25 2022. Review of changes

The CWE Top 25 list reflects the most serious software security weaknesses. I invite you to read the updated top list to become aware of the changes happened over the past year.

CWE Top 25 2022. Review of changes

by Mikhail Gelvih

From the article:

Below is a table of correspondence between the CWE Top 25 2022 list and the PVS-Studio diagnostic rules, divided by programming languages. You can always check the most up-to-date table with CWE Top 25 coverage on our website.