C++ Memory Management - an Interview with Patrice Roy
Patrice Roy has written a book on C++ Memory Management for Packt, this is an interview about his book
C++ Memory Management - an interview with Patrice Roy
March 19-21, Madrid, Spain
April 1-4, Bristol, UK
June 16-21, Sofia, Bulgaria
By Meeting C++ | Mar 28, 2025 02:48 PM | Tags: performance meetingcpp community c++20 c++17 basics advanced
Patrice Roy has written a book on C++ Memory Management for Packt, this is an interview about his book
C++ Memory Management - an interview with Patrice Roy
By Blog Staff | Mar 28, 2025 12:44 PM | Tags: None
In this blog post, we’ll explore implementing order-independent keyword arguments for C++ through use of C++26’s proposed reflection features. I stumbled upon this technique while experimenting with reflection a few days ago and thought it might be worthwhile to share, as it nicely showcases just how powerful the proposed reflection features are.
Fun with C++26 reflection - Keyword Arguments
by Che
From the article:
An example implementation of the technique presented in this blog post can be found on GitHub. It can be used with Bloomberg’s experimental P2996 clang fork. If you enjoy these shenanigans, feel free to leave a star.
Prior art
Named, labeled or keyword arguments have been proposed many times over the years, but as EWG issue 150 notes: all of these attempts have failed. Here is several past proposals on the topic:
Since none of these proposals were accepted, we have to be somewhat creative to get similar functionality in C++. Naturally, there are various approaches to this problem. Below is a short overview of what you can already do without reflection.
Designated initializers
Let’s start with the simplest way to achieve keyword argument-like syntax. C++20 introduced designated initializers for aggregate types, which gives us the initialization syntax
Point{.x=42, .y=7}
.In a function call’s argument list the type can potentially be deduced, so we could write
foo({.x=2, .y=2})
. While this requires extra curly braces and.
-prefixes for every member name, syntactically this is almost what we want.
By Blog Staff | Mar 26, 2025 01:27 PM | Tags: None
Memory diagnostic tools can be divided into runtime detection tools like Address Sanitizer (ASAN), Valgrind, and Application Verifier, and recording tools like rr and Time Travel Debugging (TTD). While runtime tools help catch memory errors as they occur, recording tools allow developers to trace memory modifications over time, making them a powerful combination for debugging complex issues.
A Brief and Incomplete Comparison of Memory Corruption Detection Tools
by Raymond Chen
From the article:
I promised last time to do a comparison of memory diagnostic tools. We have runtime diagnostic tools Address Sanitizer (ASAN), Valgrind, and Application Verifier (AppVerifier, avrf), and we have recording tools rr, and Time Travel Debugging (TTD)
First, the runtime tools:
ASAN detects a lot more types of memory errors, but it requires that you recompile everything. This can be limiting if you suspect that the problem is coming from a component you cannot recompile (say because you aren’t set up to recompile it, or because you don’t have the source code). Valgrind and AppVerifier have the advantage that you can turn them on for a process without requiring a recompilation. That means that you can ask a customer to turn it on at their site, without having to deliver a custom build to them. This is even more important on Windows because you have no chance of giving them an ASAN-enabled version of, say, kernel32.dll.
By Blog Staff | Mar 24, 2025 01:24 PM | Tags: None
In C++, if an object’s constructor fails (due to an exception), destructors are run for the object’s member variables and base classes, but not for the object itself. The principle at play is that you cannot destruct something that was never constructed in the first place.
Reminder: When a C++ Object Fails to Construct, the Destructor Does Not Run
by Raymond Chen
From the article:
Consider this pull request:
com_timeout_t(DWORD timeoutInMilliseconds) : m_threadId(GetCurrentThreadId()) { m_cancelEnablementResult = CoEnableCallCancellation(nullptr); err_policy::HResult(m_cancelEnablementResult); if (SUCCEEDED(m_cancelEnablementResult)) { m_timer.reset(CreateThreadpoolTimer( &com_timeout_t::timer_callback, this, nullptr)); err_policy::LastErrorIfFalse( static_cast<bool>(m_timer)); if (m_timer) { FILETIME ft = filetime::get_system_time(); ft = filetime::add(ft, filetime:: convert_msec_to_100ns(timeoutInMilliseconds)); SetThreadpoolTimer(m_timer.get(), &ft, timeoutInMilliseconds, 0); } } } ~com_timeout_t() { m_timer.reset(); if (SUCCEEDED(m_cancelEnablementResult)) { CoDisableCallCancellation(nullptr); } } ⟦ member variables: ⟧ HRESULT m_cancelEnablementResult{}; DWORD m_threadId{}; bool m_timedOut{}; wil::unique_threadpool_timer_nocancel m_timer;The idea is that the constructor first callsCoEnableCallCancellation
and reports the failure viaerr_policy::
.HResult()
By Blog Staff | Mar 22, 2025 01:37 PM | Tags: None
Bjarne Stroustrup, the creator of C++, has outlined his vision for the language’s future in his article "21st Century C++," emphasizing the need for safer and more modern coding practices without abandoning its powerful legacy. His approach advocates for incremental improvements, such as guideline-enforcing profiles and enhanced type safety, ensuring C++ remains relevant in an era of heightened security and performance demands.
Bjarne Stroustrup's Vision for 21st Century C++: Balancing Legacy, Safety, and Innovation
by Darryl K. Taft & David Cassel
From the article:
Bjarne Stroustrup, the mind behind the venerable C++ programming language, has once again entered the fray to shape the language’s future, publishing a weighty, 6,300-word piece titled "21st Century C++" in Communications of the ACM. Central to his argument is the idea that while C++ itself cannot drastically change due to its extensive legacy, the practices surrounding it can and must adapt. His manifesto outlines a path forward, advocating for tools like guideline-enforcing profiles to detect and mitigate coding errors, alongside a deliberate, type-safe evolution of the language. Stroustrup's call to action is as much about preserving the language's relevance in an era of heightened attention to memory safety as it is about addressing criticism aimed at C++’s historical complexities.
"21st Century C++" and the Pursuit of Safety Without Sacrificing Power
C++ is a linguistic titan. It powers systems that range from high-frequency trading platforms to embedded systems in spacecraft, and yet its intricate, low-level control has often been a double-edged sword. For Stroustrup, the path forward lies in preserving this power while ensuring safer usage—a delicate dance that avoids alienating the vast community reliant on its compatibility with decades-old code. In "21st Century C++," Stroustrup suggests that the way forward lies in shifting the culture and tools surrounding the language, rather than the language itself.One of the most critical elements of his vision is the concept of "guideline-enforcing profiles."
By Administrator | Mar 21, 2025 01:44 PM | Tags: None
The 2025-03 mailing of new standards papers is now available.
WG21 Number | Title | Author | Document Date | Mailing Date | Previous Version | Subgroup |
---|---|---|---|---|---|---|
N5004 | 2025 Sofia Meeting Invitation and Information | Vassil Vassilev | 2025-01-14 | 2025-03 | All of WG21 | |
N5005 | WG21 2025-01 Hagenberg Admin telecon minutes | Nina Ranns | 2025-01-31 | 2025-03 | All of WG21 | |
N5006 | 2025 WG21 admin telecon meetings (revised 2025-02-20) | Herb Sutter | 2025-03-03 | 2025-03 | All of WG21 | |
N5007 | WG21 02/2025 Hagenberg Minutes of Meeting | Nina Ranns | 2025-03-03 | 2025-03 | All of WG21 | |
N5008 | Working Draft, Programming Languages -- C++ | Thomas Köppe | 2025-03-15 | 2025-03 | All of WG21 | |
N5009 | Editors' Report, Programming Languages -- C++ | Thomas Köppe | 2025-03-15 | 2025-03 | All of WG21 | |
P0260R15 | C++ Concurrent Queues | Detlef Vollmann | 2025-02-13 | 2025-03 | P0260R14 | SG1 Concurrency and Parallelism,LEWG Library Evolution |
P0260R16 | C++ Concurrent Queues | Detlef Vollmann | 2025-02-15 | 2025-03 | P0260R15 | SG1 Concurrency and Parallelism,LEWG Library Evolution |
P0876R20 | fiber_context - fibers without scheduler | Oliver Kowalke | 2025-02-27 | 2025-03 | P0876R19 | EWG Evolution,CWG Core,LWG Library |
P1494R5 | Partial program correctness | S. Davis Herring | 2025-03-04 | 2025-03 | P1494R4 | CWG Core,LWG Library |
P1967R14 | #embed - a simple, scannable preprocessor-based resource acquisition method | JeanHeyd Meneide | 2025-02-17 | 2025-03 | P1967R13 | CWG Core |
P2079R7 | System execution context | Lucian Radu Teodorescu | 2025-02-12 | 2025-03 | P2079R6 | LEWG Library Evolution |
P2287R4 | Designated-initializers for base classes | Barry Revzin | 2025-03-10 | 2025-03 | P2287R3 | EWG Evolution |
P2414R6 | Pointer lifetime-end zap proposed solutions | Paul E. McKenney | 2025-02-13 | 2025-03 | P2414R5 | SG1 Concurrency and Parallelism,LEWG Library Evolution,LWG Library |
P2663R7 | Proposal to support interleaved complex values in std::simd | Daniel Towner | 2025-02-17 | 2025-03 | P2663R6 | LWG Library |
P2719R4 | Type-aware allocation and deallocation functions | Louis Dionne | 2025-02-10 | 2025-03 | P2719R3 | CWG Core |
P2758R5 | Emitting messages at compile time | Barry Revzin | 2025-03-16 | 2025-03 | P2758R4 | CWG Core,LWG Library |
P2781R6 | std::constexpr_wrapper | Zach Laine | 2025-02-16 | 2025-03 | P2781R5 | LEWG Library Evolution,LWG Library |
P2781R7 | std::constexpr_wrapper | Zach Laine | 2025-03-09 | 2025-03 | P2781R6 | LEWG Library Evolution,LWG Library |
P2781R8 | std::constexpr_wrapper | Zach Laine | 2025-03-15 | 2025-03 | P2781R7 | LEWG Library Evolution,LWG Library |
P2786R12 | Trivial Relocatability For C++26 | Pablo Halpern | 2025-02-10 | 2025-03 | P2786R11 | CWG Core,LWG Library |
P2786R13 | Trivial Relocatability For C++26 | Pablo Halpern | 2025-02-14 | 2025-03 | P2786R12 | All of WG21 |
P2825R5 | Overload resolution hook: declcall( unevaluated-call-expression ) | Gašper Ažman | 2025-03-16 | 2025-03 | P2825R4 | EWG Evolution,CWG Core |
P2830R10 | Standardized Constexpr Type Ordering | Gašper Ažman | 2025-03-15 | 2025-03 | P2830R9 | EWG Evolution,LEWG Library Evolution,CWG Core,LWG Library |
P2841R7 | Concept and variable-template template-parameters | Corentin Jabot | 2025-02-15 | 2025-03 | P2841R6 | CWG Core |
P2843R2 | Preprocessing is never undefined | Alisdair Meredith | 2025-03-17 | 2025-03 | P2843R1 | CWG Core |
P2846R6 | reserve_hint: Eagerly reserving memory for not-quite-sized lazy ranges | Corentin Jabot | 2025-02-15 | 2025-03 | P2846R5 | LWG Library |
P2863R9 | Review Annex D for C++26 | Alisdair Meredith | 2025-03-11 | 2025-03 | P2863R8 | EWG Evolution,CWG Core,LWG Library |
P2873R3 | Remove Deprecated locale category facets for Unicode from C++26 | Alisdair Meredith | 2025-03-17 | 2025-03 | P2873R2 | LWG Library |
P2876R2 | Proposal to extend std::simd with more constructors and accessors | Daniel Towner | 2025-02-14 | 2025-03 | P2876R1 | LWG Library |
P2899R1 | Contracts for C++ - Rationale | Timur Doumler | 2025-03-14 | 2025-03 | P2899R0 | SG21 Contracts,EWG Evolution,LEWG Library Evolution |
P2900R14 | Contracts for C++ | Joshua Berne | 2025-02-14 | 2025-03 | P2900R13 | CWG Core,LWG Library |
P2933R4 | std::simd overloads for <bit> header | Daniel Towner | 2025-02-17 | 2025-03 | P2933R3 | LWG Library |
P2988R10 | std::optional<T&> | Steve Downey | 2025-02-18 | 2025-03 | P2988R9 | LWG Library |
P2988R11 | std::optional<T&> | Steve Downey | 2025-03-17 | 2025-03 | P2988R10 | LWG Library |
P2996R10 | Reflection for C++26 | Barry Revzin | 2025-02-26 | 2025-03 | P2996R9 | EWG Evolution |
P3008R4 | Atomic floating-point min/max | Gonzalo Brito Gadeschi | 2025-02-20 | 2025-03 | P3008R3 | LWG Library |
P3016R6 | Resolve inconsistencies in begin/end for valarray and braced initializer lists | Arthur O'Dwyer | 2025-02-11 | 2025-03 | P3016R5 | LWG Library |
P3019R13 | Vocabulary Types for Composite Class Design | Jonathan Coe | 2025-02-09 | 2025-03 | P3019R12 | LEWG Library Evolution,LWG Library |
P3019R14 | Vocabulary Types for Composite Class Design | Jonathan Coe | 2025-02-11 | 2025-03 | P3019R13 | LEWG Library Evolution,LWG Library |
P3060R2 | Add std::views::indices(n) | Weile Wei | 2025-02-20 | 2025-03 | P3060R1 | LWG Library |
P3070R3 | Formatting enums | Victor Zverovich | 2025-02-16 | 2025-03 | P3070R2 | LWG Library |
P3074R6 | trivial unions (was std::uninitialized<T>) | Barry Revzin | 2025-02-11 | 2025-03 | P3074R5 | EWG Evolution |
P3074R7 | trivial unions (was std::uninitialized<T>) | Barry Revzin | 2025-02-14 | 2025-03 | P3074R6 | EWG Evolution |
P3081R2 | Core safety profiles for C++26 | Herb Sutter | 2025-02-03 | 2025-03 | P3081R1 | EWG Evolution,LEWG Library Evolution |
P3096R6 | Function Parameter Reflection in Reflection for C++26 | Adam Lach | 2025-02-07 | 2025-03 | P3096R5 | CWG Core,LWG Library |
P3096R7 | Function Parameter Reflection in Reflection for C++26 | Adam Lach | 2025-03-15 | 2025-03 | P3096R6 | CWG Core,LWG Library |
P3104R3 | Bit permutations | Jan Schultke | 2025-02-11 | 2025-03 | P3104R2 | LEWG Library Evolution |
P3111R4 | Atomic Reduction Operations | Gonzalo Brito Gadeschi | 2025-02-14 | 2025-03 | P3111R3 | LEWG Library Evolution |
P3111R5 | Atomic Reduction Operations | Gonzalo Brito Gadeschi | 2025-02-20 | 2025-03 | P3111R4 | CWG Core,LWG Library |
P3137R3 | views::to_input | Tim Song | 2025-02-10 | 2025-03 | P3137R2 | LWG Library |
P3149R9 | async_scope -- Creating scopes for non-sequential concurrency | Ian Petersen | 2025-02-18 | 2025-03 | P3149R8 | LWG Library |
P3161R3 | Unified integer overflow arithmetic | Tiago Freire | 2025-01-16 | 2025-03 | P3161R2 | SG6 Numerics |
P3179R6 | C++ parallel range algorithms | Ruslan Arutyunyan | 2025-02-07 | 2025-03 | P3179R5 | LEWG Library Evolution |
P3179R7 | C++ parallel range algorithms | Ruslan Arutyunyan | 2025-02-28 | 2025-03 | P3179R6 | LWG Library |
P3229R1 | Making erroneous behaviour compatible with Contracts | Timur Doumler | 2025-02-10 | 2025-03 | P3229R0 | EWG Evolution,LEWG Library Evolution |
P3230R2 | views::unchecked_(take|drop) | Hewill Kang | 2025-02-27 | 2025-03 | P3230R1 | SG9 Ranges,LEWG Library Evolution,LWG Library |
P3242R1 | Copy and fill for mdspan | Nicolas Morales | 2025-03-13 | 2025-03 | P3242R0 | LEWG Library Evolution |
P3248R3 | Require [u]intptr_t | Gonzalo Brito Gadeschi | 2025-02-10 | 2025-03 | P3248R2 | EWG Evolution,LEWG Library Evolution |
P3284R3 | `write_env` and `unstoppable` Sender Adaptors | Eric Niebler | 2025-02-13 | 2025-03 | P3284R2 | LWG Library |
P3287R3 | Exploration of namespaces for std::simd | Matthias Kretz | 2025-02-13 | 2025-03 | P3287R2 | LWG Library |
P3296R4 | let_async_scope | Anthony Williams | 2025-03-17 | 2025-03 | P3296R3 | LWG Library |
P3319R3 | Add an iota object for simd (and more) | Matthias Kretz | 2025-02-03 | 2025-03 | P3319R2 | LEWG Library Evolution |
P3319R4 | Add an iota object for simd (and more) | Matthias Kretz | 2025-02-14 | 2025-03 | P3319R3 | LEWG Library Evolution |
P3319R5 | Add an iota object for simd (and more) | Matthias Kretz | 2025-02-14 | 2025-03 | P3319R4 | LWG Library |
P3331R1 | Accessing The First and Last Elements in Associative Containers | Nikita Sakharin | 2025-02-05 | 2025-03 | P3331R0 | LEWG Library Evolution,LWG Library |
P3349R1 | Converting contiguous iterators to pointers | Jonathan Wakely | 2025-02-10 | 2025-03 | P3349R0 | LWG Library |
P3365R1 | Remove the Deprecated iterator Class Template from C++26 | Alisdair Meredith | 2025-03-11 | 2025-03 | P3365R0 | LWG Library |
P3366R1 | Remove Deprecated Atomic Initialization API from C++26 | Alisdair Meredith | 2025-03-16 | 2025-03 | P3366R0 | LWG Library |
P3367R4 | constexpr coroutines | Hana Dusíková | 2025-02-17 | 2025-03 | P3367R3 | CWG Core,LWG Library |
P3372R3 | constexpr containers and adapters | Hana Dusíková | 2025-02-11 | 2025-03 | P3372R2 | LWG Library |
P3378R2 | constexpr exception types | Hana Dusíková | 2025-02-11 | 2025-03 | P3378R1 | LWG Library |
P3383R2 | mdspan.at() | Stephan Lachnit | 2025-02-17 | 2025-03 | P3383R1 | LWG Library |
P3385R4 | Attributes reflection | Aurelien Cassagnes | 2025-03-10 | 2025-03 | P3385R3 | SG7 Reflection,EWG Evolution,LEWG Library Evolution |
P3394R2 | Annotations for Reflection | Daveed Vandevoorde | 2025-03-14 | 2025-03 | P3394R1 | CWG Core,LWG Library |
P3395R1 | Fix encoding issues and add a formatter for std::error_code | Victor Zverovich | 2025-03-12 | 2025-03 | P3395R0 | LEWG Library Evolution |
P3395R2 | Fix encoding issues and add a formatter for std::error_code | Victor Zverovich | 2025-03-17 | 2025-03 | P3395R1 | LEWG Library Evolution |
P3400R1 | Specifying Contract Assertion Properties with Labels | Joshua Berne | 2025-02-28 | 2025-03 | P3400R0 | SG21 Contracts,All of WG21 |
P3417R1 | Handling exceptions thrown from contract predicates | Gašper Ažman | 2025-03-05 | 2025-03 | P3417R0 | SG21 Contracts,EWG Evolution |
P3430R3 | simd issues: explicit, unsequenced, identity-element position, and members of disabled simd | Matthias Kretz | 2025-02-13 | 2025-03 | P3430R2 | LWG Library |
P3441R1 | Rename simd_split to simd_chunk | Daniel Towner | 2025-01-29 | 2025-03 | P3441R0 | LEWG Library Evolution |
P3441R2 | Rename simd_split to simd_chunk | Daniel Towner | 2025-01-30 | 2025-03 | P3441R1 | LEWG Library Evolution |
P3442R1 | [[invalidate_dereferencing]] attribute | Patrice Roy | 2025-02-11 | 2025-03 | P3442R0 | SG14 Low Latency,LEWG Library Evolution |
P3471R3 | Standard Library Hardening | Konstantin Varlamov | 2025-02-13 | 2025-03 | P3471R2 | SG23 Safety and Security,LEWG Library Evolution |
P3471R4 | Standard Library Hardening | Konstantin Varlamov | 2025-02-14 | 2025-03 | P3471R3 | CWG Core,LWG Library |
P3472R1 | Make fiber_context::can_resume() const | Andrzej Krzemieński | 2025-01-28 | 2025-03 | P3472R0 | LEWG Library Evolution |
P3475R2 | Defang and deprecate memory_order::consume | Hans Boehm | 2025-02-25 | 2025-03 | P3475R1 | SG1 Concurrency and Parallelism,EWG Evolution,LEWG Library Evolution,CWG Core,LWG Library |
P3477R3 | There are exactly 8 bits in a byte | JF Bastien | 2025-02-10 | 2025-03 | P3477R2 | LEWG Library Evolution,CWG Core,LWG Library |
P3477R4 | There are exactly 8 bits in a byte | JF Bastien | 2025-02-13 | 2025-03 | P3477R3 | CWG Core |
P3477R5 | There are exactly 8 bits in a byte | JF Bastien | 2025-03-15 | 2025-03 | P3477R4 | EWG Evolution,LEWG Library Evolution |
P3480R4 | std::simd is a range | Matthias Kretz | 2025-02-14 | 2025-03 | P3480R3 | LEWG Library Evolution |
P3481R2 | std::execution::bulk() issues | Lucian Radu Teodorescu | 2025-02-11 | 2025-03 | P3481R1 | LEWG Library Evolution |
P3482R1 | Design for C++ networking based on IETF TAPS | Thomas Rodgers, Woven By Toyota, [email protected] | 2025-01-13 | 2025-03 | P3482R0 | SG4 Networking |
P3491R2 | define_static_{string,object,array} | Barry Revzin | 2025-03-14 | 2025-03 | P3491R1 | EWG Evolution,LEWG Library Evolution |
P3492R1 | Sized deallocation for placement new | Lauri Vasama | 2025-02-10 | 2025-03 | P3492R0 | EWG Evolution |
P3492R2 | Sized deallocation for placement new | Lauri Vasama | 2025-02-17 | 2025-03 | P3492R1 | EWG Evolution,CWG Core |
P3499R1 | Exploring strict contract predicates | Timur Doumler | 2025-02-09 | 2025-03 | P3499R0 | EWG Evolution |
P3500R1 | Are Contracts "safe"? | Timur Doumler | 2025-02-09 | 2025-03 | P3500R0 | EWG Evolution |
P3503R1 | Make type-erased allocator use in promise and packaged_task consistent | Nicolas Morales | 2025-03-16 | 2025-03 | P3503R0 | LWG Library |
P3503R2 | Make type-erased allocator use in promise and packaged_task consistent | Nicolas Morales | 2025-03-17 | 2025-03 | P3503R1 | LWG Library |
P3505R0 | Fix the default floating-point representation in std::format | Victor Zverovich | 2025-03-16 | 2025-03 | LEWG Library Evolution | |
P3516R1 | Uninitialized algorithms for relocation | Louis Dionne | 2025-02-11 | 2025-03 | P3516R0 | LEWG Library Evolution |
P3526R0 | Container truncation | Peter Bindels | 2025-03-17 | 2025-03 | LEWG Library Evolution | |
P3533R2 | constexpr virtual inheritance | Hana Dusíková | 2025-02-17 | 2025-03 | P3533R1 | CWG Core |
P3537R1 | Presentation on Concurrent Queue API | Detlef Vollmann | 2025-02-11 | 2025-03 | P3537R0 | All of WG21 |
P3540R1 | #embed Parameter offset | JeanHeyd Meneide | 2025-02-17 | 2025-03 | P3540R0 | CWG Core |
P3544R0 | ranges::to view | Hewill Kang | 2025-02-11 | 2025-03 | SG9 Ranges | |
P3547R1 | Modeling Access Control With Reflection | Dan Katz | 2025-02-09 | 2025-03 | P3547R0 | SG7 Reflection,EWG Evolution,LEWG Library Evolution,LWG Library |
P3552R1 | Add a Coroutine Task Type | Dietmar Kühl | 2025-03-16 | 2025-03 | P3552R0 | SG1 Concurrency and Parallelism,LEWG Library Evolution |
P3556R0 | Input files are source files | Alisdair Meredith | 2025-03-17 | 2025-03 | CWG Core | |
P3557R1 | High-Quality Sender Diagnostics with Constexpr Exceptions | Eric Niebler | 2025-02-13 | 2025-03 | P3557R0 | LEWG Library Evolution |
P3558R1 | Core Language Contracts By Default | Joshua Berne | 2025-02-02 | 2025-03 | P3558R0 | SG21 Contracts,SG23 Safety and Security |
P3561R1 | Index based coproduct operations on variant, and library wording | Esa Pulkkinen | 2025-01-16 | 2025-03 | P3561R0 | LEWGI SG18: LEWG Incubator |
P3568R1 | break label; and continue label; | Jan Schultke | 2025-03-13 | 2025-03 | P3568R0 | SG22 Compatibility,EWG Evolution |
P3570R0 | optional variants in sender/receiver | Fabio Fracassi | 2025-02-10 | 2025-03 | LEWG Library Evolution | |
P3579R1 | Fix matching of non-type template parameters when matching template template parameters | Matheus Izvekov | 2025-02-10 | 2025-03 | P3579R0 | CWG Core |
P3589R1 | C++ Profiles: The Framework | Gabriel Dos Reis | 2025-02-03 | 2025-03 | P3589R0 | EWG Evolution |
P3591R0 | Contextualizing Contracts Concerns | Joshua Berne | 2025-02-03 | 2025-03 | SG21 Contracts,EWG Evolution,LEWG Library Evolution | |
P3592R0 | Resolving Concerns with const-ification | Joshua Berne | 2025-02-10 | 2025-03 | SG21 Contracts,EWG Evolution | |
P3599R0 | Initial Implicit Contract Assertions | Joshua Berne | 2025-02-03 | 2025-03 | SG21 Contracts,SG23 Safety and Security,EWG Evolution | |
P3603R0 | Consteval-only Values and Consteval Variables | Barry Revzin | 2025-03-13 | 2025-03 | EWG Evolution | |
P3605R0 | isqrt: A function to calculate integer square root of the nonnegative integer | Nikita Sakharin | 2025-02-05 | 2025-03 | LEWGI SG18: LEWG Incubator,LEWG Library Evolution,LWG Library | |
P3606R0 | On Overload Resolution, Exact Matches and Clever Implementations | Corentin Jabot | 2025-01-27 | 2025-03 | EWG Evolution | |
P3608R0 | Contracts and profiles: what can we reasonably ship in C++26 | Ville Voutilainen | 2025-02-01 | 2025-03 | EWG Evolution,LEWG Library Evolution | |
P3611R0 | Dealing with pointer errors: Separating static and dynamic checking | Bjarne Stroustrup | 2025-02-04 | 2025-03 | SG23 Safety and Security,EWG Evolution,LEWG Library Evolution | |
P3613R0 | On the beating of horses, and other matters | Tim Song | 2025-03-17 | 2025-03 | SG9 Ranges | |
P3614R0 | Do not remove nor postpone access_context::unchecked | Ville Voutilainen | 2025-02-06 | 2025-03 | EWG Evolution | |
P3615R0 | C++ Standard Library Ready Issues to be moved in Hagenberg, Feb. 2025 | Jonathan Wakely | 2025-02-07 | 2025-03 | All of WG21 | |
P3616R0 | Remove contracts on virtual functions for now | Ville Voutilainen | 2025-02-08 | 2025-03 | EWG Evolution | |
P3618R0 | Allow attaching main to the global module | Michael Spencer | 2025-02-11 | 2025-03 | EWG Evolution | |
P3619R0 | Counter-examples for P2688R5 | Vlad Serebrennikov | 2025-02-10 | 2025-03 | EWG Evolution | |
P3619R1 | Counter-examples for P2688R5 | Vlad Serebrennikov | 2025-02-12 | 2025-03 | P3619R0 | EWG Evolution |
P3620R0 | Concerns with the proposed addition of fibers to C++ 26 | David Chisnall | 2025-02-10 | 2025-03 | EWG Evolution,CWG Core,LWG Library | |
P3623R0 | Add noexcept to [iterator.range] (LWG 3537) | Arthur O'Dwyer | 2025-02-11 | 2025-03 | LWG Library | |
P3625R0 | either neither | Michael Florian Hava | 2025-02-11 | 2025-03 | LEWG Library Evolution | |
P3626R0 | Make predicate exceptions propagate by default | Timur Doumler | 2025-02-11 | 2025-03 | EWG Evolution | |
P3627R0 | Easy-to-adopt security profiles for preventing RCE (remote code execution) in existing C++ code | Ulfar Erlingsson | 2025-02-11 | 2025-03 | SG23 Safety and Security | |
P3628R0 | break label; and continue label;, tl; dr | Jan Schultke | 2025-02-12 | 2025-03 | EWGI SG17: EWG Incubator | |
P3630R0 | Slides for P3568R0 | Jan Schultke | 2025-02-12 | 2025-03 | EWG Evolution | |
P3632R0 | P3564R0: Make the concurrent forward progress guarantee usable in bulk | Mark Hoemmen | 2025-02-13 | 2025-03 | SG1 Concurrency and Parallelism | |
P3632R1 | P3564R0: Make the concurrent forward progress guarantee usable in bulk | Mark Hoemmen | 2025-02-13 | 2025-03 | P3632R0 | SG1 Concurrency and Parallelism |
P3633R0 | A Byte is a Byte | Murat Can Cagri | 2025-02-13 | 2025-03 | EWG Evolution,LEWG Library Evolution | |
P3635R0 | We shouldn't rush to require either CHAR_BIT==8 or (u)intNN_t | Nevin Liber | 2025-02-13 | 2025-03 | EWG Evolution,LEWG Library Evolution | |
P3636R0 | LEWG Hagenberg presentation for P3581 No, inplace_vector shouldn't have an Allocator | Nevin Liber | 2025-02-13 | 2025-03 | LEWG Library Evolution | |
P3637R0 | Inherit std::meta::exception from std::exception | Victor Zverovich | 2025-03-08 | 2025-03 | LEWG Library Evolution | |
P3638R0 | Core Language Working Group "ready" Issues for the February, 2025 meeting | Jens Maurer | 2025-02-14 | 2025-03 | CWG Core | |
P3639R0 | The _BitInt Debate | Jan Schultke | 2025-02-20 | 2025-03 | SG6 Numerics,EWG Evolution,LEWG Library Evolution | |
P3640R0 | Make contracts reliable by default | Jonas Persson | 2025-03-17 | 2025-03 | SG21 Contracts,SG23 Safety and Security,EWG Evolution | |
P3641R0 | Rename std::observable to std::observable_checkpoint, and add a feature-test macro | Jan Schultke | 2025-03-13 | 2025-03 | LEWG Library Evolution | |
P3642R0 | Carry-less product: std::clmul | Jan Schultke | 2025-03-13 | 2025-03 | SG6 Numerics,LEWGI SG18: LEWG Incubator | |
P3643R0 | std::to_signed and std::to_unsigned | Jan Schultke | 2025-03-13 | 2025-03 | LEWG Library Evolution | |
P3650R0 | 21st Century C++ | Bjarne Stroustrup | 2025-03-05 | 2025-03 | All of WG21 | |
P3651R0 | Note to the C++ standards committee members | Bjarne Stroustrup | 2025-03-06 | 2025-03 | All of WG21 | |
P3652R0 | Constexpr floating-point <charconv> functions | Lénárd Szolnoki | 2025-03-15 | 2025-03 | LEWGI SG18: LEWG Incubator,LEWG Library Evolution | |
P3654R0 | Slides for P3516 | Giuseppe D'Angelo | 2025-03-09 | 2025-03 | LEWG Library Evolution | |
P3655R0 | zstring_view | Peter Bindels | 2025-03-17 | 2025-03 | LEWG Library Evolution | |
P3656R0 | Initial draft proposal for core language UB white paper: Process and major work items | Herb Sutter | 2025-03-11 | 2025-03 | EWG Evolution | |
P3657R0 | A Grammar for Whitespace Characters | Alisdair Meredith | 2025-03-17 | 2025-03 | CWG Core | |
P3658R0 | Adjust identifier following new Unicode recommendations | Robin Leroy | 2025-03-13 | 2025-03 | SG16 Unicode | |
P3660R0 | Improve `reference_wrapper` Ergonomics | Jeremy Rifkin | 2025-03-17 | 2025-03 | LEWGI SG18: LEWG Incubator |
By Blog Staff | Mar 21, 2025 01:17 PM | Tags: None
Today, we’ll look at a crash that occurred when trying to erase an element from a
std::set
.
The Case of the Crash When Trying to Erase an Element from a std::set
by Raymond Chen
From the article:
rax=000001f565bc046e rbx=000001f589b20340 rcx=000001f565bc046e rdx=000000e6658feca8 rsi=000001f589b20690 rdi=000001f589b203c0 rip=00007ffdd4726bc4 rsp=000000e6658fec30 rbp=0000388a1713ab55 r8=000001f589b895d0 r9=000001f589b895d0 r10=000001f589000140 r11=0000000000000000 r12=0000000000000001 r13=000000007ffe0385 r14=0000000000000000 r15=000001f589b8f900 LitWare!std::_Tree<std::_Tset_traits<WidgetWatcher *, std::less<WidgetWatcher *>, std::allocator<WidgetWatcher *>,0> >::_Eqrange+0x14 [inlined in LitWare!std::_Tree<std::_Tset_traits< WidgetWatcher *,std::less<WidgetWatcher *>, std::allocator<WidgetWatcher *>,0> >::erase+0x18]: 00007ffd`d4726bc4 cmp byte ptr [rax+19h],r11b ds:000001f5`65bc0487=??The stack trace has some information about how we got here.
LitWare!std::_Tree<std::_Tset_traits<Widget *, std::less<Widget *>, std::allocator<Widget *>,0> >::_Eqrange+0x14 LitWare!std::_Tree<std::_Tset_traits<Widget *, std::less<Widget *>, std::allocator<Widget *>,0> >::erase+0x18 LitWare!Widget::~Widget+0xc8 LitWare!Widget::`scalar deleting destructor'+0x14 LitWare!DestroyWidget+0x15 Fabrikam!Doodad::~Doodad+0x75 Fabrikam!Doodad::`scalar deleting destructor'+0x14 Fabrikam!Doodad::Release+0x40 Contoso!Gadget::~Gadget+0x66 ucrtbase!<lambda_⟦...⟧>::operator()+0xa5 ucrtbase!__crt_seh_guarded_call<int>::operator()<⟦...⟧>+0x3b ucrtbase!__acrt_lock_and_call+0x1c ucrtbase!_execute_onexit_table+0x3d Contoso!dllmain_crt_process_detach+0x45 Contoso!dllmain_dispatch+0xe6 ntdll!LdrpCallInitRoutine+0xb0 ntdll!LdrShutdownProcess+0x260 ntdll!RtlExitUserProcess+0x114 kernel32!FatalExit+0xb ucrtbased!exit_or_terminate_process+0x3a ucrtbased!common_exit+0x85 ucrtbased!exit+0x16
By Blog Staff | Mar 18, 2025 01:12 PM | Tags: None
In today's post, I'll learn how modern C++ can influence the code you write for your embedded system. You will see code using up to C++23. The example I show you below circles around at least two questions I got various times from customers: What is consteval good for? What is that user-defined literal operator, and why should I care?
C++ for Embedded Systems: constexpr and consteval
by Andreas Fertig
From the article:
Chapter One: What is a MAC address?
I teach a lot of classes to customers who are developing embedded systems. That makes sense. I worked for a long time in that domain, and I enjoyed it so much.One recurring topic is networking. While nowadays we have various different network types and technologies, let's use the Internet Protocol (IP) today. The base of network communication is your Network Interface Card (NIC). Each NIC has a unique Medium Control Address (MAC) assigned. The MAC address is the base layer for everything on top, like TCP/IP.
A MAC address consists of exactly six bytes. One way to represent a MAC address in code is this:
By Blog Staff | Mar 14, 2025 01:05 PM | Tags: None
The
std::map
subscript operator ([]
) is a convenient but sometimes dangerous feature, as it can create unintended default-constructed entries. By understanding the behavior of various map insertion and lookup methods—such as insert
, emplace
, try_emplace
, and insert_or_assign
—developers can write more efficient and predictable code while avoiding unnecessary key-value creations and duplicate lookups.
A Simplified Overview of Ways to Add or Update Elements in a std::map
by Raymond Chen
From the article:
Some time ago, I mentioned how the
std::
subscript operator is a dangerous convenience. In that article, I linked to an overview of the insertion emplacement methods, but I’m going to recapture the essential points in a table.¹map In the table below, the discussion of “consumed” or “not consumed” refers to the case that
v
is an rvalue reference likestd::
.move(something) We can reorganize the table by effect.
Exercise: Why are the bottom left two boxes blank?
By Blog Staff | Mar 12, 2025 01:00 PM | Tags: None
C++26 introduces pack indexing as a core language feature, making it significantly easier to extract specific elements from parameter packs using a familiar subscript syntax. This improvement, proposed by Corentin Jabot and Pablo Halpern, eliminates the need for cumbersome workarounds like recursive templates or boolean expression tricks, providing a more intuitive and readable approach.
C++26: pack indexing
by Sandor Dargo
From the article:
C++11 introduced parameter packs to provide a safer way to pass an undefined number of parameters to functions instead of relying on variadic functions.
While packs are a useful feature, and since C++17 it’s so easy to use them in fold expressions, extracting a specific element of a pack is somewhat cumbersome.
You either have to rely on some standard functions not made for the purpose or use “awkward boolean expression crafting or recursive templates”. None of them is unbearable, but it might be error-prone or simply expensive regarding compile-time performance. Nevertheless, they are not the most readable solutions.
C++26 brings us pack indexing as a core language feature thanks to the proposal of Corentin Jabot and Pablo Halpern, P2662R3.
Before discussing some interesting points, first, let’s look at an example: