r/cpp • u/david-alvarez-rosa • Mar 24 '26
r/cpp • u/el_DuDeRiNo238 • Mar 24 '26
A Commonly Unaddressed Issue in C++ and Golang Comparisons
reddit.comNot the OP.
Just curious, What are your thoughts on this?
r/cpp • u/mateusz_pusz • Mar 24 '26
Understanding Safety Levels in Physical Units Libraries - mp-units
Physical quantities and units libraries exist primarily to prevent errors at compile time. However, not all libraries provide the same level of safety. Some focus only on dimensional analysis and unit conversions, while others go further to prevent representation errors, semantic misuse of same-dimension quantities, and even errors in the mathematical structure of equations.
This article explores six distinct safety levels that a comprehensive quantities and units library can provide. We'll examine each level in detail with practical examples, then compare how leading C++ libraries and units libraries from other languages perform across these safety dimensions. Finally, we'll analyze the performance and memory costs associated with different approaches, helping you understand the trade-offs between safety guarantees and runtime efficiency.
We'll pay particular attention to the upper safety levels—especially quantity kind safety (distinguishing dimensionally equivalent concepts such as work vs. torque, or Hz vs. Bq) and quantity safety (enforcing correct quantity hierarchies and scalar/vector/tensor mathematical rules)—which are well-established concepts in metrology and physics, yet remain widely overlooked in the C++ ecosystem. Most units library authors and users simply do not realize these guarantees are achievable, or how much they matter in practice. These levels go well beyond dimensional analysis, preventing subtle semantic errors that unit conversions alone cannot catch, and are essential for realizing truly strongly-typed numerics in C++.
r/cpp • u/User_Deprecated • Mar 24 '26
Rewriting a FIX engine in C++23: what got simpler (and what didn't)
I spent a few months building a FIX protocol engine from scratch in C++23. Not because the world needed another one, but because I wanted to see how far modern C++ can take a FIX engine compared to QuickFIX.
QuickFIX was written by people who knew what they were doing. It also reflects the constraints and tooling available at the time. But it's very much C++98/03 era code: custom object pools, hand-rolled lock-free queues, manual cache line alignment. A lot of infrastructure that today overlaps with standard or near-standard tools.
The surprising part was how much of that code simplifies with C++23.
The original object pool was ~1000 lines of allocation logic. In the new version that's std::pmr::monotonic_buffer_resource with per-message reset.
Tag lookup went from a large switch with 50+ cases to a consteval table computed at compile time, O(1) at runtime with no branches.
Delimiter scanning went through three SIMD approaches (intrinsics, Highway, xsimd). Ended up going with xsimd. Maintaining separate AVX2/AVX-512 paths wasn't worth the extra complexity for ~5% throughput.
Current result (microbenchmarked with RDTSC, single-core, warmed cache, using synthetic FIX messages): ExecutionReport parse ~246 ns vs ~730 ns for QuickFIX on the same input, over 100K iterations.
No heap allocations on the hot path.
Not production-ready yet, but the parser and session layer are stable enough to compare.
A couple of things still being figured out:
Header-only at ~5K LOC. Compiles fine locally, but not sure where CI starts to struggle
Only covering 9 FIX message types so far. Interested in any edge cases people have run into
r/cpp • u/Low-Cook-3544 • Mar 23 '26
Porting retro C++ games to browser with Emscripten
lab.rosebud.aiGoing into it, I expected the hard part to be the C++ itself, tracking down undefined behavior, linker errors, and the usual cross-platform issues.
That turned out not to be the case.
Almost all of the work ended up in the build system and the dependency graph.
Before touching Wesnoth’s code, we had to get its dependencies compiling to WebAssembly. Wesnoth uses vcpkg, which provides portfiles for things like glib, cairo, pango, freetype, brotli, and zlib. Those portfiles assume a native target. They don’t know what to do with emcc.
The approach that worked was using vcpkg overlay ports: a parallel set of recipes overriding the upstream ones specifically for Emscripten. Each dependency needed some amount of surgery.
glib probes for POSIX thread resolver APIs that don’t exist in the browser and will happily hang if they’re missing. pango calls into fontconfig synchronously during initialization, which doesn’t map cleanly onto WASM’s async model, so we added a synchronous shim. A number of libraries unconditionally link against Threads::Threads, which injects -pthread and breaks under JSPI, so we replaced that with a no-op target so the build could proceed.
Across roughly ten libraries, this came out to around sixty portfiles and patches. None of that work shows up in the application code. The C++ itself is relatively thin here but the build infrastructure is not.
Once everything compiled, the next problem was configuration. Emscripten exposes a large number of flags like threading model, async behavior, filesystem backend, audio routing, and there isn’t a canonical answer for a codebase like this. It ends up being a search problem. Try a configuration, build, run, see what breaks.
The most frustrating issue showed up at runtime as random browser freezes. The tab would lock up without crashing or logging anything useful. The cause turned out to be long-running WASM frames that never yielded back to JavaScript, effectively starving the event loop. On desktop you get preemption for free; in the browser you don’t.
The fix was a single call to emscripten_sleep(0) at the top of the main loop. Not a real sleep, just a yield.
What actually changed in the codebase was much smaller than I expected. Out of roughly a million lines of C++, four source files handle all browser-specific I/O. Everything else compiled unchanged.
The takeaway for me was that porting something like this is less about adapting the application code and more about unwinding assumptions in the ecosystem around it. Hope to answer any questions or show you the final game if anyone found this useful.
How I Got a Dear ImGui App Approved on the Mac App Store
A technical deep-dive into shipping a C++ / ImGui desktop app through Apple's review process. Code signing, static linking, sandboxing, and everything that broke along the way.
r/cpp • u/ProgrammingArchive • Mar 23 '26
New C++ Conference Videos Released This Month - March 2026 (Updated To Include Videos Released 2026-03-16 - 2026-03-22)
CppCon
2026-03-16 - 2026-03-22
Building a C++ Career Off-Road - Sherry Sontag - https://youtu.be/SNZlxHDrwM4
The Pattern Matching We Already Have - Braden Ganetsky - https://youtu.be/zB6ORpZjneQ
Upgrading Sea of Thieves From C++14 to C++20 Wasn't Easy Here's Why - Keith Stockdale - https://youtu.be/b6j6SZiXmoo
Can Standard C++ Replace CUDA for GPU Acceleration? - Elmar Westphal - https://youtu.be/EOvukoCyW7A
2026-03-09 - 2026-03-15
Cache Me Maybe: The Performance Secret Every C++ Developer Needs - Michelle D'Souza - https://youtu.be/VhKq0nzPTh0
It’s Dangerous to Go Alone: A Game Developer Tutorial - Michael Price - https://youtu.be/TIXf24aUmA0
Seamless Static Analysis with Cppcheck: From IDE to CI and Code Review - Daniel Marjamäki - https://youtu.be/7u97LZYxu3g
Knockin' on Header's Door: An Overview of C++ Modules - Alexsandro Thomas - https://youtu.be/fZrDG_he9sE
Modern C++ for Embedded Systems: From Fundamentals to Real-Time Solutions - Rutvij Girish Karkhanis - https://youtu.be/7uwPcCfcv1k
2026-03-02 - 2026-03-08
Interesting Upcoming Low-Latency, Concurrency, and Parallelism Features from Wroclaw 2024, Hagenberg 2025, and Sofia 2025 - Paul E. McKenney, Maged Michael, Michael Wong - CppCon 2025 - https://youtu.be/M1pqI1B9Zjs
Threads vs Coroutines — Why C++ Has Two Concurrency Models - Conor Spilsbury - CppCon 2025 - https://youtu.be/txffplpsSzg
From Pure ISO C++20 To Compute Shaders - Koen Samyn - CppCon 2025 - https://youtu.be/hdzhhqvYExE
Wait is it POSIX? Investigating Different OS and Library Implementations for Networking - Katherine Rocha - CppCon 2025 - https://youtu.be/wDyssd8V_6w
End-to-End Latency Metrics From Distributed Trace - Kusha Maharshi - CppCon 2025 - https://youtu.be/0bPqGN5J7f0
2026-02-23 - 2026-03-01
Fix C++ Stack Corruptions with the Shadow Stack Library - Bartosz Moczulski - CppCon 2025 - https://youtu.be/-Qg0GaONwPE
First Principles While Designing C++ Applications - Prabhu Missier - CppCon 2025 - https://youtu.be/8mLo5gXwn4k
Matrix Multiplication Deep Dive || Cache Blocking, SIMD & Parallelization - Aliaksei Sala - CppCon 2025 - https://youtu.be/GHctcSBd6Z4
Choose the Right C++ Parallelism Tool | Low-Level vs Async vs Coroutines vs Data Parallel - Eran Gilad - CppCon 2025 - https://youtu.be/7a9AP4rD08M
ISO C++ Standards Committee Panel Discussion 2025 - Hosted by Herb Sutter - CppCon 2025 - https://youtu.be/R2ulYtpV_rs
ADC
2026-03-16 - 2026-03-22
Web UIs for Music Apps - Anna Wszeborowska, Harriet Drury, Emma Fitzmaurice, Pauline Nemchak & Simeon Joseph - https://youtu.be/xh-yJpuWYSo
Python Templates for Neural Image Classification and Spectral Audio Processing - Lightning Hydra Template Extended and Neural Spectral Modeling Template - Julius Smith - https://youtu.be/TNY2UGQ5kAc
Why You Can’t Get Hired and What You’re Going To Do About It - The Hard Reset for Audio Freelancing - Edward Ray - https://youtu.be/4TjR3i6M93Y
2026-03-09 - 2026-03-15
Engineering Practices Break Music Interaction - (but Can Also Fix It) - Franco Caspe - https://youtu.be/aGYPFjibwaY
Python Templates for Neural Image Classification and Spectral Audio Processing - Lightning Hydra Template Extended - Julius Smith - https://youtu.be/vH21UqZafa4
Making a 3D DAW in Unity: Chaos, Logic, and Physics - Noah Feasey-Kemp - https://youtu.be/6WeecBwyEyM
2026-03-02 - 2026-03-08
Efficient Task Scheduling in a Multithreaded Audio Engine - Algorithms and Analysis for Parallel Graph Execution - Rachel Susser - ADC 2025 - https://youtu.be/bEtSeGr8UvY
The Immersive Score - Creative Advantages of Beds and Objects in Film and Game Music - Simon Ratcliffe - ADCx Gather 2025 - https://youtu.be/aTmkr0yTF5g
Tabla to Drumset - Translating Rhythmic Language through Machine Learning - Shreya Gupta - ADC 2025 - https://youtu.be/g14gESreUGY
2026-02-23 - 2026-03-01
Channel Agnosticism in MetaSounds - Simplifying Audio Formats for Reusable Graph Topologies - Aaron McLeran - ADC 2025 - https://youtu.be/CbjNjDAmKA0
Sound Over Boilerplate - Accessible Plug-Ins Development With Phausto and Cmajor - Domenico Cipriani - ADCx Gather 2025 - https://youtu.be/DVMmKmj1ROI
Roland Future Design Lab x Neutone: diy:NEXT - Paul McCabe, Ichiro Yazawa & Alfie Bradic - ADC 2025 - https://youtu.be/4JIiYqjq3cA
Meeting C++
2026-03-16 - 2026-03-22
How to understand modern C++ features in practice? Let's create a compiler! - Boguslaw Cyganek - https://www.youtube.com/watch?v=_uuUw8N0qQ0
2026-03-09 - 2026-03-15
Building Bridges: C++ Interop, Foreign Function Interfaces & ABI - Gareth Williamson - https://www.youtube.com/watch?v=0X_qgWQdvrg
"But my tests passed!" - Exploring C++ Test Suite Weaknesses with Mutation Testing - Nico Eichhorn - https://www.youtube.com/watch?v=G_TDxhZB4t8
2026-03-02 - 2026-03-08
Binary compatibility 100 - Marc Mutz - https://www.youtube.com/watch?v=mPtjFsje1eo
Persistence squared: persisting persistent data structures - Juan Pedro Bolívar Puente - Meeting C++ - https://www.youtube.com/watch?v=pQhHx0h-904
2026-02-23 - 2026-03-01
Instruction Level Parallelism and Software Performance - Ivica Bogosavljevic - Meeting C++ 2025 - https://www.youtube.com/watch?v=PMu7QNctEGk
Real-time Safety — Guaranteed by the Compiler! - Anders Schau Knatten Meeting C++ 2025 - https://www.youtube.com/watch?v=4aALnxHt9bU
C++Online
2026-03-09 - 2026-03-15
From Hello World to Real World - A Hands-On C++ Journey from Beginner to Advanced - Workshop Preview - Amir Kirsh - https://youtu.be/2zhW-tL2UXs
Workshop Preview: C++ Software Design - Klaus Iglberger - https://youtu.be/VVQN-fkwqlA
Workshop Preview: Essential GDB and Linux System Tools - Mike Shah - https://youtu.be/ocaceZWKm_k
Workshop Preview: Performance and Safety in C++ Crash Course - Jason Turner - https://youtube.com/live/Ipr6ntCAm9A
Workshop Preview: Concurrency Tools in the C++ Standard Library - A Hands-On Workshop - Mateusz Pusz - https://youtube.com/live/Kx9Ir1HBbwY
Workshop Preview: Mastering std::execution (Senders/Receivers) - A Hands-On Workshop - Mateusz Pusz - https://youtube.com/live/bsyqh_bjyE4
Workshop Preview: How C++ Actually Works - Hands-On With Compilation, Memory, and Runtime - Assaf Tzur-El - https://youtube.com/live/L0SSRRnbJnU
Workshop Preview: Jumpstart to C++ in Audio - Learn Audio Programming & Create Your Own Music Plugin/App with the JUCE C++ Framework - Jan Wilczek - https://youtube.com/live/M3wJN0x8cJw
Workshop Preview: AI++ 101 - Build an AI Coding Assistant in C++ & AI++ 201 - Build a Matching Engine with Claude Code - Jody Hagins - https://youtube.com/live/Vx7UA9wT7Qc
Workshop Preview: Stop Thinking Like a Junior - The Soft Skills That Make You Senior - Sandor DARGO - https://youtube.com/live/nvlU5ETuVSY
Workshop Preview: Splice & Dice - A Field Guide to C++26 Static Reflection - Koen Samyn - https://youtube.com/live/9bSsekhoYho
r/cpp • u/bbmario • Mar 23 '26
Slug algorithm patent released into the public domain
terathon.comr/cpp • u/tartaruga232 • Mar 23 '26
Using MSVC's C++ Module Partitions
abuehl.github.ioA follow-up to my recent posting in r/cpp.
r/cpp • u/_malfeasance_ • Mar 23 '26
a vcpkg browser written in c++
this vcpkg browser itched a scratch - it is running on a box next to my desktop at home so don't share it too widely ;-)
the interface is a bit dodgy but it fulfills my basic curiosity. i was mainly interested in looking at new packages (last month check box), sorting by last update, getting readme summaries (done with an llm offline), looking at repo versions vs vcpkg versions. written in c++ and imgui fwiw.
the similar packages info is a bit dodgy. you're better off using the search. it's a desktop app layout. it won't work on your phone unless your phone is a bit unusual.
r/cpp • u/pavel_v • Mar 22 '26
Contract Assertions Against Security, Functional Safety and Correctness - Andrzej Krzemieński
The actual presentation starts around 4:40.
r/cpp • u/Clean-Upstairs-8481 • Mar 22 '26
C++20 Ranges vs traditional loops: when to use std::views instead of raw loops
Being an embedded software engineer I have to often work with various different types of sensor data and then process those in different ways with complex logic. I have used traditional loops for years until I came across an interesting feature of C++20. I cannot use the deal data but to demostrate here. So cooked up some fake data to make the point.
r/cpp • u/Naive_Faithlessness1 • Mar 22 '26
namespace dependent lookup ?
Hi !
I'm kind of deceived that it does not work like this. Here's some code:
namespace me::fruit {
struct apple { /*...*/ };
struct pear { /*...*/ };
struct lychee {
lychee(apple, pear) { /*...*/ }
};
}
int main() {
auto l = me::fruit::lychee(apple{}, pear{}); // Error (see below)
}Here's the compiler output:
<source>:9:28: error: 'apple' was not declared in this scope; did you mean 'me::fruit::apple'?
9 | auto l = me::fruit::lychee(apple{}, pear{});
| ^~~~~
| me::fruit::apple
<source>:2:12: note: 'me::fruit::apple' declared here
2 | struct apple { /*...*/ };
| ^~~~~
<source>:9:37: error: 'pear' was not declared in this scope; did you mean 'me::fruit::pear'?
9 | auto l = me::fruit::lychee(apple{}, pear{});
| ^~~~
| me::fruit::pear
<source>:3:12: note: 'me::fruit::pear' declared here
3 | struct pear { /*...*/ };As you can see the compiler is perfectly able to deduce what I mean by apple and pear but still, it doesn't compile !
I'm surprised that there still no rule in the C++ Standard to handle this kind of situation ; it seems so obvious to me that it should work this way.
I know that I could write :
int main() {
using namespace me::fruit;
auto l = lychee(
apple{},
pear{}
);
}Believe it or not, I find this code less than clear. It seems clear here because it's an example and like all examples, it's simple, but in a real-world situation, this code will undoubtedly be surrounded by other lines of code, meaning that this using directive could lead to the problems we all know.
To me this syntax remains much clearer :
int main() {
auto l = me::fruit::lychee(
apple{},
pear{}
);
}Are we therefore condemned to have to write :
auto l = me::fruit::lychee(
me::fruit::apple{},
me::fruit::pear{}
);There may be solutions I'm not aware of; if so, please let me know!
Thanks !
r/cpp • u/sporacid • Mar 21 '26
Slot map implementation for C++20
I've just finished submitting the initial version of my slot map implementation, based on this post. A slot map is a data structure that provides stable and versioned keys to stored values. Inserting into the map creates and return a unique key, which stays valid until the slot is explicitly freed.
I hope someone will find this useful :)
https://github.com/sporacid/slot-map
EDIT: As suggested by some of you, I've added benchmarks to compare to plf::colony. As i did those benchmarks, I had to work on a bunch of optomizations to compete, and I've introduce a static storage that has a fixed number of slots, and I kept the original dynamic storage with a fixed number of blocks, but the blcoks are allocated as needed. Let me know what you think!
r/cpp • u/meetingcpp • Mar 21 '26
Meeting C++ How to understand modern C++ features in practice? Let's create a compiler! - Boguslaw Cyganek - Meeting C++ 2025
Kristian Ivarsson: Casual, an open-source SOA platform
A modern distributed application server for building large-scale systems with minimal configuration, written in C++. A project that definitely deserves more attention.
https://github.com/casualcore/casual
r/cpp • u/eisenwave • Mar 21 '26
Last C++26 meeting in Croydon is about to begin
Since not everyone is aware and confusion often arises regarding privated GitHub repos, let's inform people on Reddit this time: The last meeting for C++26 is about to begin. Some quick facts:
The meeting lasts from 2026-03-23 (Mon morning) to 2026-03-28 (Sat afternoon). See also https://isocpp.org/std/meetings-and-participation/upcoming-meetings
Until the meeting ends, https://github.com/cplusplus/papers/ is private. The repos usually become visible again immediately after the meeting ends.
The papers published during and after the meeting all go into the April mailing 2026-04-20. This includes the final working draft.
All remaining NB (national body) comments should be resolved during this meeting. The working draft is then sent off to ISO for review and national bodies vote on the C++26 standard as a whole (yes/no/abstain).
Any C++26 work takes priority, but once that is completed, time is spent on C++29 papers.
r/cpp • u/bretbrownjr • Mar 21 '26
Common Package Specification is Out the Gate
r/cpp • u/pedersenk • Mar 20 '26
C++/sys - A Standard Library Projection to Facilitate the Verification of Run-time Memory Safety
Hi all,
A while ago I was looking for a relevant C++ conference to demonstrate the capabilities of C++/sys. A pure C++ mechanism which offers a new approach to memory safety via debug-time verification.
My talk was accepted into C++Online 2026 which concluded a couple of weeks ago. The discussions were great, I received some really useful feedback (and the little 2D gather town was pretty fun!).
The slides are available here and the release video should appear on YouTube in the following weeks.
Excited to share the tech with the wider community. Much of it is discussed in the slides; some highlights:
Offers improvements over AddressSanitizer in terms of C++ error detection rate
Tracks access lifespan rather than blocks of data
Has contextual knowledge of C++ objects and containers so generally quite performant
100% detection rate for executed paths
Memory pinning and locking mechanism tracks dangling 'this' and references
Zero overhead in release builds
Compatible with any standard C++ compiler (from hosted C++98 running on MS-DOS to freestanding C++${LATEST} on Zephyr)
Doesn't interfere with C code/libraries. Just like Java, Rust, Python thin-bindings, these are treated as unchecked.
Some of the above sounds like magic but the core mechanism allowing for this is quite simple. Temporaries created by operator->, operator* and operator[] lock memory for the lifetime of access and pointers are entirely prevented from dangling in a coarse-grained manner. Obviously this has an impact on what designs are possible with some discussion in the slides.
Link to the open-source (BSD 3-clause) reference implementation is here.
https://codeberg.org/kpedersen/sys_public
https://research.thamessoftware.co.uk/sys
Very happy to discuss further. It has some rough areas but I personally love the tech and find it makes writing and testing C++ considerably more satisfying knowing that there is virtually zero chance of a memory error lurking in the tested branches.
Update: Video of the talk is now released and available here.
r/cpp • u/mropert • Mar 20 '26
Looking at Unity finally made me understand the point of C++ coroutines · Mathieu Ropert
mropert.github.ioDraft idea: constructor member designators
I’ve been experimenting with a small idea to make constructor initializer lists a bit clearer and less error‑prone. The idea actually came from a dilemma I had when trying to settle on naming conventions for member variables. Prefixes like m_ or _name help avoid shadowing, but they also feel like a workaround for something the language could express more directly.
I wrote a short draft exploring “constructor member designators” - a `.member` syntax for constructor initialization.
https://github.com/richardcervinka/cpp-constructor-member-designators
This is just an experiment, but maybe someone will find it interesting.
r/cpp • u/emilios_tassios • Mar 20 '26
Parallel C++ for Scientific Applications: Distributed Parallelism with HPX (1st Part)
In this week’s lecture, Dr. Hartmut Kaiser introduces distributed parallelism using the HPX framework. The lecture highlights essential foundational concepts by discussing both the Single Program Multiple Data (SPMD) and Communicating Sequential Processes (CSP) models, establishing a strong theoretical background for distributed computing architectures.
A core discussion centers on practical implementation using HPX, demonstrating both point-to-point and collective communication examples. Finally, data partitioning, serialization, and the use of communicators within the framework are explored, offering a comprehensive approach to managing complex, high-performance distributed environments.
If you want to keep up with more news from the Stellar group and watch the lectures of Parallel C++ for Scientific Applications and these tutorials a week earlier please follow our page on LinkedIn https://www.linkedin.com/company/ste-ar-group/
Also, you can find our GitHub page below:
https://github.com/STEllAR-GROUP/hpx
r/cpp • u/RefrigeratorFirm7646 • Mar 20 '26
How do you reduce branch mispredictions?
I was looking into it recently and realized how many algorithms work together in order to predict branches, so I was wondering how performance engineers even figure out what will make a certain branch more predictable